Submission #712543

#TimeUsernameProblemLanguageResultExecution timeMemory
712543gnhmhpNizin (COCI16_nizin)C++17
100 / 100
67 ms10164 KiB
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr) #include <bits/stdc++.h> using namespace std; const int maxn=1e6+5; long long a[maxn]; int main() { fastio; int n; cin >> n; for (int i=1; i<=n; ++i) cin >> a[i]; int i, j, ans=0; for (i=1, j=n; i<j; ) { ++ans; if (a[i]<a[j]) { a[i+1]+=a[i]; ++i; } else if (a[i]>a[j]) { a[j-1]+=a[j]; --j; } else ++i, --j, --ans; } cout << ans; }
#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...