Submission #548769

#TimeUsernameProblemLanguageResultExecution timeMemory
548769ala2Street Lamps (APIO19_street_lamps)C++14
20 / 100
3505 ms1360 KiB
#include <iostream> using namespace std; int ans[110][110]; string s; int f(int i,int j) { for(int k=i;k<j;k++) { if(s[k]=='0') return 0; } return 1; } int main() { int n,m; cin>>n>>m; //string s; cin>>s; while(m--) {for(int i=0;i<n;i++) { for(int j=i+1;j<=n;j++) { if(f(i,j)) ans[i][j]++; } } string c; cin>>c; if(c[0]=='q') { int a,b; cin>>a>>b; a--; b--; cout<<ans[a][b]<<endl; } else { int i; cin>>i; i--; if(s[i]=='1') s[i]='0'; else s[i]='1'; } } }
#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...