# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
716528 | 2023-03-30T08:59:29 Z | 1zaid1 | Street Lamps (APIO19_street_lamps) | C++17 | 109 ms | 3956 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 328 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 320 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 109 ms | 3956 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Incorrect | 2 ms | 340 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 328 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 320 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Incorrect | 109 ms | 3956 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |