Submission #112580

#TimeUsernameProblemLanguageResultExecution timeMemory
112580ioilolcomNizin (COCI16_nizin)C++14
100 / 100
62 ms6268 KiB
#include <bits/stdc++.h> using namespace std; #define endl "\n" typedef long long int ll; int arr[1000009]; int solve(int i,int j){ if(i>=j) return 0; if(arr[i]==arr[j]) { return solve(i+1,j-1); } else if(arr[i]>arr[j]) { arr[j-1]+=arr[j]; return 1+solve(i,j-1); } else { arr[i+1]+=arr[i]; return 1+solve(i+1,j); } } int main() { ios_base:: sync_with_stdio(false); cin.tie(0); int n; cin>>n; for(int i=1; i<=n; i++) cin>>arr[i]; cout<<solve(1,n)<<endl; 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...