Submission #903600

#TimeUsernameProblemLanguageResultExecution timeMemory
903600Tenis0206Street Lamps (APIO19_street_lamps)C++11
20 / 100
2 ms604 KiB
#include <bits/stdc++.h> using namespace std; const int nmax = 100; int n,q; int s[nmax + 5][nmax + 5]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin>>n>>q; for(int i=1;i<=n;i++) { char ch; cin>>ch; s[1][i] = ch - '0'; } for(int i=1;i<=q;i++) { string tip; cin>>tip; for(int j=1;j<=n;j++) { s[i + 1][j] = s[i][j]; } if(tip == "query") { int a,b; cin>>a>>b; --b; int rez = 0; for(int t=1;t<=i;t++) { bool ok = true; for(int j=a;j<=b;j++) { if(s[t][j] != 1) { ok = false; } } rez += ok; } cout<<rez<<'\n'; } else { int poz; cin>>poz; if(s[i + 1][poz] == 0) { s[i + 1][poz] = 1; } else { s[i + 1][poz] = 0; } } } 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...