Submission #706571

#TimeUsernameProblemLanguageResultExecution timeMemory
706571YugiHackerNizin (COCI16_nizin)C++14
100 / 100
66 ms10180 KiB
#include<bits/stdc++.h> #define el cout<<"\n" #define f0(i,n) for(int i=0;i<n;++i) #define f1(i,n) for(int i=1;i<=n;++i) #define maxn 1000006 using namespace std; int n; long long a[maxn]; main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n; f1 (i, n) cin >> a[i]; int l=1, r=n; int ans = 0; while (r > l) { if (a[l] == a[r]) { l++, r--; continue; } if (a[l] < a[r]) a[l+1] += a[l], l++; else a[r-1] += a[r], r--; ans++; } cout << ans; }

Compilation message (stderr)

nizin.cpp:9:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    9 | main()
      | ^~~~
#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...