Submission #156450

#TimeUsernameProblemLanguageResultExecution timeMemory
156450mdn2002Nizin (COCI16_nizin)C++14
100 / 100
266 ms8312 KiB
#include<bits/stdc++.h> using namespace std; long long mod=1e9+7; long long n,a[1000006]; int main() { cin>>n; for(int i=0;i<n;i++)cin>>a[i]; long long l=0,r=n-1,lsum=a[0],rsum=a[n-1],ans=0; while(l<r) { if(lsum<rsum) { l++; lsum+=a[l]; ans++; } else if(lsum>rsum) { r--; rsum+=a[r]; ans++; } else { lsum=a[l+1]; rsum=a[r-1]; l++; r--; } } cout<<ans; }
#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...