# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
143061 | 2019-08-12T20:10:15 Z | JovanK26 | 가로등 (APIO19_street_lamps) | C++14 | 78 ms | 73996 KB |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,q; cin >> n >> q; if(n<=100 && q<=100) { string s; cin >> s; int a[n][q]; for(int i=0;i<n;i++) { a[i][0]=s[i]-'0'; } string qry; int l,r; int t; for(int i=1;i<=q;i++) { cin >> qry; if(qry=="toggle") { cin >> t; for(int j=0;j<n;j++) { a[j][i]=a[j][i-1]; } a[t-1][i]^=1; } else { cin >> l >> r; long long rez=0; for(int time=0;time<i;time++) { bool check=0; for(int j=l-1;j<r-1;j++) { if(!a[j][time]) { check=1; break; } } if(!check)rez++; } for(int j=0;j<n;j++) { a[j][i]=a[j][i-1]; } cout << rez <<'\n'; } } } else { bitset<300001> bs1[n]; bitset<300001> bs2[q]; cin >> bs2[0]; string qry; int l,r; int p; for(int i=0;i<q;i++) { cin >> qry; if(qry=="toggle") { cin >> p; bitset<300001> tmp; tmp[p]=1; bs2[i+1]=bs2[i]^tmp; } else { cin >> l >> r; int rez=0; for(int j=0;j<=i;j++) { rez+=bs2[i][l-1]; } bitset<300001> tmp; bs2[i+1]=bs2[i]^tmp; cout << rez <<'\n'; } } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 10 ms | 7928 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 78 ms | 73960 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 77 ms | 73996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 504 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 3 ms | 376 KB | Output is correct |
7 | Correct | 3 ms | 376 KB | Output is correct |
8 | Runtime error | 10 ms | 7928 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Halted | 0 ms | 0 KB | - |