Submission #242532

# Submission time Handle Problem Language Result Execution time Memory
242532 2020-06-28T06:38:23 Z VEGAnn Nizin (COCI16_nizin) C++14
0 / 100
61 ms 4216 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1000100;
int ans = 0, a[N], n;
bool ed = 0;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> a[i];

    int lf = 0, rt = n - 1;

    while (!ed){
        while (a[lf] != a[rt]){
            if (lf + 1 == rt){
                ans++;
                ed = 1;
            }

            if (a[lf] < a[rt]){
                a[lf + 1] += a[lf];
                lf++;
            } else {
                a[rt - 1] += a[rt];
                rt--;
            }
        }

        if (lf + 1 >= rt - 1)
            ed = 1;
        else {
            lf++;
            rt--;
        }
    }

    cout << ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 5 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 3320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 61 ms 4216 KB Output isn't correct
2 Halted 0 ms 0 KB -