Submission #594241

#TimeUsernameProblemLanguageResultExecution timeMemory
594241vuavisaoNizin (COCI16_nizin)C++14
100 / 100
58 ms10172 KiB
#include<bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define ll long long using namespace std; const int N = 1e6 + 10; int n; ll a[N]; int res; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; for(int l = 1, r = n; l <= r;) { while(a[l] != a[r]) { if(a[l] < a[r]) { l++; a[l] += a[l - 1]; } else { r--; a[r] += a[r + 1]; } res++; } l++; r--; } cout << res; return 0; } /// Code by vuavisao
#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...