Submission #526697

# Submission time Handle Problem Language Result Execution time Memory
526697 2022-02-16T02:15:25 Z joelau Izbori (COCI22_izbori) C++14
15 / 110
70 ms 14416 KB
#include <bits/stdc++.h>
using namespace std;

long long N,A[200005];
map<long long,long long> mp;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin >> N;
    for (long long i = 0; i < N; ++i) cin >> A[i];
    long long ans = N * (N+1) / 2, cnt = 0;
    mp[cnt]++;
    for (long long i = 0; i < N; ++i) {
        if (A[i] == 1) cnt--;
        else cnt++;
        ans -= mp[cnt]++;
    }
    cout << ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1304 KB Output is correct
2 Correct 15 ms 1680 KB Output is correct
3 Correct 13 ms 1028 KB Output is correct
4 Correct 15 ms 1732 KB Output is correct
5 Correct 36 ms 1740 KB Output is correct
6 Correct 17 ms 1848 KB Output is correct
7 Correct 16 ms 1868 KB Output is correct
8 Correct 19 ms 1868 KB Output is correct
9 Correct 19 ms 1860 KB Output is correct
10 Correct 14 ms 1888 KB Output is correct
11 Correct 70 ms 14416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -