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>
using namespace std;
#define ll long long
#define pll pair<ll, ll>
#define f first
#define s second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
#define pb push_back
#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<" "<<#__VA_ARGS__<<": ", _do(__VA_ARGS__)
template<typename T> void _do(T && x ){ cerr<<x<<endl; }
template<typename T, typename ...S> void _do(T && x , S&&...y){ cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define IOS() ios::sync_with_stdio(0),cin.tie(0)
#define endl '\n'
#define bug(...)
#endif // BALBIT
const int maxn = 3e5+5;
//vector<pii> g[maxn];
bool hi[maxn];
int ans[105][105];
signed main(){
IOS();
int n,q; cin>>n>>q;
for (int i = 0; i<n; ++i) {
char c; cin>>c; hi[i] = c=='1';
}
for (int i = 0; i<q; ++i) {
for (int l = 0; l<n; ++l) {
for (int r = l; r<n; ++r) {
if (!hi[r]) break;
ans[l][r]++;
}
}
string s; cin>>s;
if (s[0] == 'q') {
int a,b; cin>>a>>b; --a; --b;
cout<<ans[a][b-1]<<endl;
}else{
int x; cin>>x;
--x;
hi[x] ^=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... |