Submission #938688

#TimeUsernameProblemLanguageResultExecution timeMemory
938688AndreibatmanStreet Lamps (APIO19_street_lamps)C++14
20 / 100
302 ms4956 KiB
#include <bits/stdc++.h> using namespace std; int n,q,i,j,ok,x,y; char sir[300010],op[30]; int mat[110][110]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>n>>q>>(sir+1); for(i=1; i<=n; i++) { ok=1; for(j=i+1; j<=n+1; j++) if(sir[j-1]=='0') break; else mat[i][j]++; } while(q--) { cin>>op>>x; if(op[0]=='t') { if(sir[x]=='0') sir[x]='1'; else sir[x]='0'; } else { cin>>y; cout<<mat[x][y]<<'\n'; } for(i=1; i<=n; i++) { ok=1; for(j=i+1; j<=n+1; j++) if(sir[j-1]=='0') break; else mat[i][j]++; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...