Submission #406683

# Submission time Handle Problem Language Result Execution time Memory
406683 2021-05-18T02:43:00 Z tengiz05 Street Lamps (APIO19_street_lamps) C++17
20 / 100
132 ms 10968 KB
#include <bits/stdc++.h>
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, q;
    std::cin >> n >> q;
    std::string v;
    std::cin >> v;
    std::vector<int> last(n, -1), ans(n);
    for (int it = 0; it < q; it++) {
        std::string type;
        std::cin >> type;
        if (type == "query") {
            int l, r;
            std::cin >> l >> r;
            l--;
            r-=2;
            int res = ans[l];
            if (v[l] == '1') res += (it - last[l]);
            std::cout << res << "\n";
        } else {
            int p;
            std::cin >> p;
            p--;
            if (v[p] == '1') {
                ans[p] += it - last[p];
            } else {
                last[p] = it;
            }
            v[p] ^= 1;
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 85 ms 3540 KB Output is correct
2 Correct 87 ms 4736 KB Output is correct
3 Correct 107 ms 5268 KB Output is correct
4 Correct 116 ms 8896 KB Output is correct
5 Correct 113 ms 9432 KB Output is correct
6 Correct 108 ms 8564 KB Output is correct
7 Correct 130 ms 9596 KB Output is correct
8 Correct 132 ms 10968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -