# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
716528 | 1zaid1 | Street Lamps (APIO19_street_lamps) | C++17 | 109 ms | 3956 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
const signed M = 1e4, MOD = 998244353;
bitset<101> bt[M];
signed main() {
cin.tie(0)->sync_with_stdio(0);
int n, q;
cin >> n >> q;
string s;
cin >> s;
for (int i = 0; i < s.size(); i++) bt[i+1][0] = s[i] == '1';
for (int i = 0; i < q; i++) {
string s;
cin >> s;
if (s == "query") {
int l, r;
cin >> l >> r;
bitset<101> b = bt[l];
for (int j = l; j < r; j++) b &= bt[j];
cout << b.count() << endl;
// cout << b << endl;
}
for (int j = 1; j <= n; j++) bt[j][i+1] = bt[j][i];
if (s == "toggle") {
int x;
cin >> x;
bt[x][i+1] = !bt[x][i+1];
}
}
// for (int i = 1; i <= n; i++){
// for (int j = 0; j < q; j++) cout << bt[i][j]; cout << endl;
// }
return 0;
}
/*
5 7
11011
query 1 2
query 1 2
query 1 6
query 3 4
toggle 3
query 3 4
query 1 6
*/
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |