# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337139 | Fidisk | Street Lamps (APIO19_street_lamps) | C++14 | 3 ms | 492 KiB |
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 oo 1e12
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO ios_base::sync_with_stdio(false); cin.tie(0)
#define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa))
#define cntbit(xxxx) __builtin_popcount(xxxx)
#define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1)
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,long long> plll;
const ll mod=1e9+7;
string s[5009],t;
ll n,q,i,res,l,r,j,k;
bool ok;
int main(){
IO;
#ifndef ONLINE_JUDGE
freopen("test.inp", "r", stdin);
freopen("test.out", "w", stdout);
#else
#endif
cin>>n>>q;
cin>>s[1];
s[1]=" "+s[1];
for (i=1;i<=q;i++) {
cin>>t;
s[i+1]=s[i];
if (t=="query") {
cin>>l>>r;
for (j=1;j<=i;j++) {
ok=true;
for (k=l;k<=r;k++) {
if (s[j][k]=='0') {
ok=false;
break;
}
}
if (ok) {
//cout<<l<<' '<<r<<' '<<s[i]<<' '<<i<<'\n';
res++;
}
}
cout<<res<<'\n';
res=0;
}
else {
cin>>j;
if (s[i+1][j]=='0') {
s[i+1][j]='1';
}
else {
s[i+1][j]='0';
}
}
}
}
Compilation message (stderr)
# | 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... |