Submission #94178

#TimeUsernameProblemLanguageResultExecution timeMemory
94178quoriessNizin (COCI16_nizin)C++14
10 / 100
155 ms8052 KiB
#include <bits/stdc++.h> #include <unistd.h> #include <set> #define dbg(x) //cout<<#x<<" has a value of: "<<x<<"\n"; typedef long long int lli; using namespace std; typedef pair<lli,lli> pii; int main(){ int n; cin>>n; vector<lli> dizi(n); for (int i = 0; i < n; i++) { cin>>dizi[i]; } int l=0,r=n-1; int cvb=0; while(l<=r){ lli ls=dizi[l],rs=0; l++; int ctl=1,ctr=0; dbg(ls); dbg(rs); while(ls!=rs){ if(l>r){ dbg(ctl); dbg(ctr); cvb+=ctl+ctr-1; break; } while(rs<ls && l<=r){ rs+=dizi[r]; ctr++; r--; dbg(rs); dbg(r); } while(ls<rs&&l<=r){ ls+=dizi[l]; ctl++; l++; dbg(ls); dbg(l); } if(l>r && ls!=rs){ dbg(ctl); dbg(ctr); cvb+=ctl+ctr-1; break; } cvb+=ctl+ctr-2; } } cout<<cvb<<"\n"; 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...