Submission #167515

#TimeUsernameProblemLanguageResultExecution timeMemory
167515theStaticMindNizin (COCI16_nizin)C++14
100 / 100
85 ms10360 KiB
#include<bits/stdc++.h> #define mp make_pair #define pb push_back #define ii pair<int,int> #define all(x) (x).begin(),(x).end() #define INF 100000000000000000 #define modulo 1000000007 #define mod 998244353 #define int long long int using namespace std; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); // freopen("q.gir","r",stdin); // freopen("q.cik","w",stdout); int n; cin>>n; vector<int>arr(n); for(int i=0;i<n;i++)cin>>arr[i]; int l=0,r=n-1,ans=0; while(l<r){ if(arr[l]<arr[r]){ l++; arr[l]+=arr[l-1]; ans++; } else if(arr[r]<arr[l]){ r--; arr[r]+=arr[r+1]; ans++; } else{ 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...