Submission #865876

#TimeUsernameProblemLanguageResultExecution timeMemory
865876jk410Street Lamps (APIO19_street_lamps)C++17
20 / 100
263 ms524288 KiB
#include <iostream> using namespace std; int N,Q; string S; bool A[101][101]; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>N>>Q>>S; for (int i=1; i<=N; i++) A[0][i]=(S[i-1]=='1'); for (int t=1; t<=Q; t++){ for (int i=1; i<=N; i++) A[t][i]=A[t-1][i]; string s; cin>>s; if (s[0]=='t'){ int x; cin>>x; A[t][x]^=true; } else{ int l,r; cin>>l>>r; int cnt=0; for (int i=0; i<t; i++){ bool flag=true; for (int j=l; j<r; j++) flag&=A[i][j]; cnt+=flag; } cout<<cnt<<"\n"; } } 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...