Submission #40886

#TimeUsernameProblemLanguageResultExecution timeMemory
40886XmtosXNizin (COCI16_nizin)C++14
100 / 100
255 ms23008 KiB
#include <bits/stdc++.h> using namespace std; int n,ans; long long a[1000006]; int main() { scanf("%d",&n); for (int i=0;i<n;i++) scanf("%I64d",&a[i]); long long l=0,r=0; for (int i=0,j=n-1;i<j;) { if (l+a[i]==r+a[j]) { l=r=0; i++; j--; } else if (l+a[i]<r+a[j]) { l+=a[i]; i++; ans++; } else { r+=a[j]; j--; ans++; } } cout <<ans; return 0; }

Compilation message (stderr)

nizin.cpp: In function 'int main()':
nizin.cpp:9:28: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
         scanf("%I64d",&a[i]);
                            ^
nizin.cpp:7:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
                   ^
nizin.cpp:9:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%I64d",&a[i]);
                             ^
#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...