Submission #95090

#TimeUsernameProblemLanguageResultExecution timeMemory
95090Rouge_HugoNizin (COCI16_nizin)C++14
70 / 100
9 ms1704 KiB
#include <bits/stdc++.h> using namespace std; int a[100009]; int main() {ios_base::sync_with_stdio(false); cin.tie(NULL); int n;cin>>n; for(int i=0;i<n;i++) { cin>>a[i]; } int re=0; long long sum=0,sum1=0; for(int i=0,j=n-1;i<n,j>-1;i++,j--) { sum+=a[i]; sum1+=a[j]; while (sum!=sum1&&i<j) { if (sum>sum1) {re++; j--; sum1+=a[j]; continue; } else if (sum1>sum) { re++; i++; sum+=a[i]; continue; } else break; } } cout<<re; return 0; }

Compilation message (stderr)

nizin.cpp: In function 'int main()':
nizin.cpp:15:21: warning: left operand of comma operator has no effect [-Wunused-value]
  for(int i=0,j=n-1;i<n,j>-1;i++,j--)
                    ~^~
#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...