Submission #510288

#TimeUsernameProblemLanguageResultExecution timeMemory
510288basheerNizin (COCI16_nizin)C++17
0 / 100
1098 ms7884 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll x,y,n,sum1,sum2,ans; int main() { cin>>n; ll a[n]; for(ll i=0; i<n; i++) cin>>a[i]; x=0; y=n-1; sum1=0; sum2=0; while(y>x) { if(a[y]==a[x]) { y--; x++; sum1=0; sum2=0; continue; } if(a[y]>a[x]) { sum1+=a[x]; x++; sum2+=a[y]; y--; } while(sum1!=sum2) { if(sum2>sum1) { sum1+=a[x]; x++; } else { sum2+=a[y]; y--; } ans++; } } cout<<ans; return 0; }
#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...