# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
209213 | 2020-03-13T12:33:21 Z | mieszko11b | Street Lamps (APIO19_street_lamps) | C++14 | 180 ms | 9720 KB |
#include <bits/stdc++.h> using namespace std; int n, q; //~ char c[107][107]; int before[300007], last0[300007]; char c[300007]; int main() { scanf("%d%d", &n, &q); //~ if(n <= 100 && q <= 100) { //~ scanf(" %s", c[0] + 1); //~ for(int i = 1 ; i <= q ; i++) { //~ char comm[10]; //~ for(int j = 1 ; j <= n ; j++) //~ c[i][j] = c[i - 1][j]; //~ scanf(" %s", comm); //~ if(comm[0] == 'q') { //~ int a, b; //~ scanf("%d%d", &a, &b); //~ int res = 0; //~ for(int j = 0 ; j < i ; j++) { //~ bool ok = true; //~ for(int k = a ; k < b ; k++) //~ if(c[j][k] == '0') //~ ok = false; //~ if(ok) res++; //~ } //~ printf("%d\n", res); //~ } else { //~ int w; //~ scanf("%d", &w); //~ if(c[i][w] == '0') c[i][w] = '1'; //~ else c[i][w] = '0'; //~ } //~ } //~ } scanf(" %s", c + 1); memset(last0, -1, sizeof last0); for(int i = 1 ; i <= q ; i++) { char comm[10]; scanf(" %s", comm); if(comm[0] == 'q') { int a, b; scanf("%d%d", &a, &b); int res = before[a]; if(c[a] == '1') res += i - last0[a] - 1; printf("%d\n", res); } else { int w; scanf("%d", &w); if(c[w] == '1') { before[w] += i - last0[w] - 1; c[w] = '0'; } else { last0[w] = i - 1; c[w] = '1'; } } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 130 ms | 5700 KB | Output is correct |
2 | Correct | 126 ms | 6008 KB | Output is correct |
3 | Correct | 126 ms | 6396 KB | Output is correct |
4 | Correct | 160 ms | 7624 KB | Output is correct |
5 | Correct | 156 ms | 7928 KB | Output is correct |
6 | Correct | 138 ms | 8440 KB | Output is correct |
7 | Correct | 173 ms | 8184 KB | Output is correct |
8 | Correct | 180 ms | 9720 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1528 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |