This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define st first
#define nd second
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define eb emplace_back
#define pp pop_back
#define mp make_pair
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vii = vector<pii>;
void debug(){cerr<<"\n";}
template<typename H, typename... T>
void debug(H h, T... t){
cerr<<h;
if(sizeof...(t)){
cerr<<", ";
}
debug(t...);
}
#define deb(x...) cerr<<#x<<" = ";debug(x);
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const int N=1<<9;
int co[N][N];
int main(){
int n, q;
cin>>n>>q;
string s;
cin>>s;
for(int i=0; i<n; i++){
co[i][0]=(s[i]-'0');
}
for(int qq=1; qq<=q; qq++){
for(int i=0; i<n; i++){
co[i][qq]=co[i][qq-1];
}
cin>>s;
if(s[0]=='q'){
//deb(qq);
int a, b;
cin>>a>>b;
a--;
b--;
int ans=0;
for(int t=0; t<qq; t++){
bool c=1;
for(int i=a; i<b; i++){
if(!co[i][t]){
c=0;
break;
}
}
if(c)ans++;
}
cout<<ans<<"\n";
}
else{
int v;
cin>>v;
v--;
co[v][qq]^=1;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |