Submission #661104

#TimeUsernameProblemLanguageResultExecution timeMemory
661104Trisanu_DasNizin (COCI16_nizin)C++17
0 / 100
135 ms4112 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; int a[n]; for(int i = 0; i < n; i++) cin >> a[i]; int l = 1, r = n, ans = 0; while(l <= r){ if(a[l] == a[r]){l++;r--;} else if(a[l] > a[r]){a[r - 1] += r; r--; ans++;} else {a[l + 1] += a[l]; l++; ans++;} } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...