# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404960 | 2021-05-15T12:05:24 Z | A_D | Street Lamps (APIO19_street_lamps) | C++14 | 4 ms | 588 KB |
#include <bits/stdc++.h> #define int long long #define ii pair<int,int> #define F first #define S second #define du long double using namespace std; const int N=1e2+10; int a[N][N]; void solve() { int n,q; cin>>n>>q; string s; cin>>s; int cnt=0; for(auto x:s){ cnt++; if(x=='1'){ a[cnt][0]=1; } else{ a[cnt][0]=0; } } for(int i=1;i<=q;i++){ for(int j=1;j<=n;j++){ a[j][i]=a[j][i-1]; } string s; cin>>s; if(s=="query"||s=="1"){ int u,v,ans=0; cin>>u>>v; for(int t=0;t<i;t++){ int bo=1; for(int j=u;j<v;j++){ bo&=a[j][t]; } ans+=bo; // cout<<bo<<" "; } //cout<<"\n"; cout<<ans<<endl; } else{ int b; scanf("%lld",&b); a[b][i]^=1; } } } main() { int t=1; //cin>>t; while(t--)solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 588 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 588 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 588 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 300 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
5 | Correct | 1 ms | 332 KB | Output is correct |
6 | Correct | 1 ms | 332 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
8 | Runtime error | 4 ms | 588 KB | Execution killed with signal 11 |
9 | Halted | 0 ms | 0 KB | - |