diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-06 23:24:22 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-06 23:24:22 +0200 |
| commit | 9dce6eaf425178ab1c37dc15b3a74f09e23e9243 (patch) | |
| tree | b5897bda0f49f15b0d6d96d470e10603e2220189 /contests/05-05-2022(Div.3)/B | |
| parent | ed4b0690e4ee35278bb656c703bd0a1ab102222f (diff) | |
| download | competitive-programming-9dce6eaf425178ab1c37dc15b3a74f09e23e9243.tar.xz competitive-programming-9dce6eaf425178ab1c37dc15b3a74f09e23e9243.zip | |
Added contests file
Diffstat (limited to 'contests/05-05-2022(Div.3)/B')
| -rwxr-xr-x | contests/05-05-2022(Div.3)/B/B | bin | 0 -> 33024 bytes | |||
| -rw-r--r-- | contests/05-05-2022(Div.3)/B/B.cpp | 48 |
2 files changed, 48 insertions, 0 deletions
diff --git a/contests/05-05-2022(Div.3)/B/B b/contests/05-05-2022(Div.3)/B/B Binary files differnew file mode 100755 index 0000000..af9715e --- /dev/null +++ b/contests/05-05-2022(Div.3)/B/B diff --git a/contests/05-05-2022(Div.3)/B/B.cpp b/contests/05-05-2022(Div.3)/B/B.cpp new file mode 100644 index 0000000..27c4853 --- /dev/null +++ b/contests/05-05-2022(Div.3)/B/B.cpp @@ -0,0 +1,48 @@ +#include<bits/stdc++.h> + +using namespace std; + +bool isIncreasing(vector<int> v){ + for(int i = 0; i < v.size() - 1; i++) { + if(v[i] >= v[i+1]) { + return false; + } + } + return true; +} +int getIndex(vector<int> v){ + int index; + for(int i = 0; i < v.size(); i++) { + vector<int> v2(i+1); + for(int j = 0; j <= i;j++){ + index = j; + v2[j] = v[j]; + } + if(!isIncreasing(v2)) { + return index; + } + } + return -1; +} + +int main () { + int tt, n; + cin >> tt; + while(tt--) { + cin >> n; + vector<int> v(n); + for(auto &x : v) { + cin >> x; + } + int idx = getIndex(v); + vector<int> rem(v.size() - idx); + if(idx == -1) { + cout << "0" << endl; + } else { + for(int i = 0;i < v.size() - idx; i++) { + rem[i] = v[idx + i]; + } + } + } + +} |
