Submission #510278

#TimeUsernameProblemLanguageResultExecution timeMemory
510278basheerNizin (COCI16_nizin)C++17
0 / 100
1092 ms4044 KiB
#include <bits/stdc++.h> using namespace std; int x,y,n,sum1,sum2,ans; int main() { cin>>n; int a[n]; for(int 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...