Submission #94141

#TimeUsernameProblemLanguageResultExecution timeMemory
94141ekremNizin (COCI16_nizin)C++98
100 / 100
86 ms4240 KiB
#include <bits/stdc++.h> #define st first #define nd second #define mp make_pair #define pb push_back #define N 1000005 using namespace std; int n, ans, bas, son, a[N]; int main() { // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); scanf("%d",&n); for(int i = 1; i <= n; i++) scanf("%d",a + i); bas = 1; son = n; while(bas < son){ if(a[bas] == a[son]){ bas++; son--; }else if(a[bas] < a[son]){ a[bas + 1] += a[bas]; bas++; ans++; } else{ a[son - 1] += a[son]; son--; ans++; } } printf("%d\n", ans); return 0; }

Compilation message (stderr)

nizin.cpp: In function 'int main()':
nizin.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
nizin.cpp:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",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...