Submission #502617

#TimeUsernameProblemLanguageResultExecution timeMemory
502617stefantagaStreet Lamps (APIO19_street_lamps)C++14
20 / 100
2 ms584 KiB
#include <bits/stdc++.h> using namespace std; int v[105][105],n,q,x,y,i,j,t; int main() { ios_base :: sync_with_stdio(false); cin.tie(0); #ifdef HOME ifstream cin("date.in"); ofstream cout("date.out"); #endif // HOME cin>>n>>q; for (i=1;i<=n;i++) { char ch; cin>>ch; v[i][0]=ch-'0'; } for (i=1;i<=q;i++) { char tip[15]; cin>>tip; if (strcmp(tip,"query")==0) { cin>>x>>y; for (j=1;j<=n;j++) { v[j][i]=v[j][i-1]; } int ok=0; for (j=0;j<i;j++) { int sum=0; for (t=x;t<y;t++) { sum=sum+v[t][j]; } if (sum==y-x) { ok++; } } cout<<ok<<'\n'; } else { cin>>x; for (j=1;j<=n;j++) { v[j][i]=v[j][i-1]; } v[x][i]=1-v[x][i]; } } 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...