# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23063 | model_code | Nizin (COCI16_nizin) | C++11 | 0 ms | 8932 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.
#include <cstdio>
#include <cassert>
using namespace std;
typedef long long llint;
const int MAXN = 1e6 + 10;
int n;
llint a[MAXN];
int main(void) {
scanf("%d", &n);
assert(n <= 1000);
for (int i = 0; i < n; ++i)
scanf("%lld", &a[i]);
int sol = 0, lo = 0, hi = n - 1;
while (lo < hi) {
if (a[lo] == a[hi]) {
++lo; --hi;
continue;
}
if (a[lo] < a[hi]) {
a[lo + 1] += a[lo];
++lo;
} else {
a[hi - 1] += a[hi];
--hi;
}
++sol;
}
printf("%d\n", sol);
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... |