Submission #934332

# Submission time Handle Problem Language Result Execution time Memory
934332 2024-02-27T07:28:52 Z haxorman Street Lamps (APIO19_street_lamps) C++14
20 / 100
129 ms 1336 KB
#include <bits/stdc++.h>
using namespace std;

const int mxN = 107;

int n, q, cnt[mxN][mxN], arr[mxN];

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

    cin >> n >> q;

    for (int i = 1; i <= n; ++i) {
        char c;
        cin >> c;

        if (c == '1') {
            arr[i] = 1;
        }
    }

    while (q--) {
        for (int i = 1; i <= n; ++i) {
            for (int j = i+1; j <= n+1; ++j) {
                if (!arr[j-1]) {
                    break;
                }
                cnt[i][j]++;
            }
        }

        string t;
        cin >> t;

        if (t[0] == 'q') {
            int a, b;
            cin >> a >> b;

            cout << cnt[a][b] << "\n";
        }
        else {
            int ind;
            cin >> ind;

            arr[ind] ^= 1;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 129 ms 1336 KB Output is correct
2 Runtime error 1 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 129 ms 1336 KB Output is correct
9 Runtime error 1 ms 604 KB Execution killed with signal 11
10 Halted 0 ms 0 KB -