# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
208888 | Sensei | Nizin (COCI16_nizin) | C++14 | 119 ms | 10632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
DATE: 2020-03-12 14:19:25
NAME:
PROBLEM: COCI16_NIZIN
*/
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6;
int main() {
int n;
cin >> n;
deque<long long> dq;
for (int i = 1; i <= n; i++) {
int t;
scanf("%d", &t);
dq.push_back(t);
}
int ans = 0;
while (dq.size() > 1) {
if (dq.front() == dq.back()) {
dq.pop_front();
dq.pop_back();
}
else if (dq.front() > dq.back()) {
long long x = dq.back();
dq.pop_back();
dq.back() += x;
ans++;
}
else {
long long x = dq.front();
dq.pop_front();
dq.front() += x;
ans++;
}
}
cout << ans << "\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |