Submission #661103

#TimeUsernameProblemLanguageResultExecution timeMemory
661103Trisanu_DasNizin (COCI16_nizin)C++17
0 / 100
142 ms6036 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...