Submission #631532

#TimeUsernameProblemLanguageResultExecution timeMemory
631532berrNizin (COCI16_nizin)C++17
100 / 100
71 ms10184 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin>>n; vector<int> a(n); for(int i=0; i<n; i++) { cin>>a[i]; } int l=0,r=n-1, s=0; while(l<r) { if(a[l]==a[r]) l++, r--; else if(a[l]<a[r]) { a[l+1]+=a[l]; s++; l++; } else { a[r-1]+=a[r]; s++; r--; } } cout<<s; }
#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...