Submission #1031744

# Submission time Handle Problem Language Result Execution time Memory
1031744 2024-07-23T06:26:42 Z stdfloat Street Lamps (APIO19_street_lamps) C++17
0 / 100
45 ms 4936 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<int> cnt(n), l(n);
    for (int z = 1; z <= q; z++) {
        string t;
        cin >> t;

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

            if (s[i] == '0') s[i] = '1';
            else {
                cnt[i] += i - l[i];
                s[i] = '0';
            }

            l[i] = z;
        }
        else {
            int a, b;
            cin >> a >> b; a--; b--;

            cout << cnt[a] + (s[a] == '1' ? z - l[a] : 0) << '\n';
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 4936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -