Submission #1031735

# Submission time Handle Problem Language Result Execution time Memory
1031735 2024-07-23T06:08:38 Z stdfloat Street Lamps (APIO19_street_lamps) C++17
20 / 100
5000 ms 524288 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

    int n, q;
    string s;
    cin >> n >> q >> s;

    vector<string> v = {s};
    while (q--) {
        string t;
        cin >> t;

        if (t == "toggle") {
            int i;
            cin >> i; i--;

            s[i] = '0' + (s[i] == '0');
        }
        else {
            int a, b;
            cin >> a >> b; a--; b--;

            int cnt = 0;
            for (auto i : v) cnt += !count(i.begin() + a, i.begin() + b, '0');

            cout << cnt << '\n';
        }

        v.push_back(s);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5030 ms 6596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1368 KB Output is correct
2 Correct 39 ms 1372 KB Output is correct
3 Correct 76 ms 1460 KB Output is correct
4 Correct 133 ms 1364 KB Output is correct
5 Runtime error 1364 ms 524288 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 128 ms 1360 KB Output is correct
2 Correct 120 ms 1476 KB Output is correct
3 Correct 75 ms 1360 KB Output is correct
4 Correct 7 ms 1372 KB Output is correct
5 Runtime error 203 ms 524288 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 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 0 ms 348 KB Output is correct
8 Execution timed out 5030 ms 6596 KB Time limit exceeded
9 Halted 0 ms 0 KB -