Submission #510078

#TimeUsernameProblemLanguageResultExecution timeMemory
510078Rasoul006Nizin (COCI16_nizin)C++17
80 / 100
31 ms9160 KiB
#include <bits/stdc++.h> #define endl "\n" ; typedef long long ll ; using namespace std; ll a[555555]; ll n,l,r,ans; int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n; for (int i=0 ; i<n ; i++) { cin>>a[i]; } r = n-1; while (l<=r) { if (a[r]==a[l]) { r--; l++; } else if (a[r]<a[l]) { a[r-1]+=a[r]; r--; ans++; } else if (a[l]<a[r]) { a[l+1]+= a[l] ; l++; 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...