diff options
| author | omagdy7 <omar.professional8777@gmail.com> | 2022-11-05 01:41:11 +0200 |
|---|---|---|
| committer | omagdy7 <omar.professional8777@gmail.com> | 2022-11-05 01:41:11 +0200 |
| commit | 7f856c7ff080b8d455b9ed16c2e57dd862c3879d (patch) | |
| tree | c2baf90f98c91567358003d6b97a4afed7fa9b42 /MakeItIncreasing/MakeItIncreasing.cpp | |
| parent | c52b36c6a37fdb1d1de146d3939cb42e2c691f44 (diff) | |
| download | competitive-programming-7f856c7ff080b8d455b9ed16c2e57dd862c3879d.tar.xz competitive-programming-7f856c7ff080b8d455b9ed16c2e57dd862c3879d.zip | |
moved some file
Diffstat (limited to 'MakeItIncreasing/MakeItIncreasing.cpp')
| -rw-r--r-- | MakeItIncreasing/MakeItIncreasing.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/MakeItIncreasing/MakeItIncreasing.cpp b/MakeItIncreasing/MakeItIncreasing.cpp deleted file mode 100644 index 987ef04..0000000 --- a/MakeItIncreasing/MakeItIncreasing.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include<bits/stdc++.h> -using namespace std; -int main() { - int tt; - cin >> tt; - while(tt--) { - int n; - int ans = 0; - cin >> n; - vector<int> v(n); - for(auto &x : v) cin >> x; - for(int i = n - 1; i > 0; i--) { - while(v[i] <= v[i-1] && v[i - 1] > 0) { - v[i-1] = v[i-1] / 2; - ans++; - } - if(v[i] == v[i-1]) { - ans = -1; - break; - } - } - cout << ans << endl; - } -} |
