# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
743832 | ThMinh_ | Street Lamps (APIO19_street_lamps) | C++14 | 259 ms | 4408 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>
#define forin(i,a,b) for(int i=a;i<=b;++i)
using namespace std;
const int N = 1e2 + 10;
int n, q;
int a[N];
int tr[N][N];
int main () {
cin.tie(0)->sync_with_stdio(0);
if(fopen("Task.inp","r")) {
freopen("Task.inp","r",stdin);
freopen("AC.out","w",stdout);
}
cin>>n>>q;
string s; cin>>s;
s = " " + s;
forin(i,1,n) a[i] = (s[i] == '1');
while(q--) {
forin(i,1,n + 1) forin(j,i + 1,n + 1) {
bool ok = 1;
forin(k,i,j - 1) ok &= a[k];
if(!ok) break;
tr[i][j]++;
}
string s; cin>>s;
if(s[0] == 't') {
int i; cin>>i;
a[i] = 1 - a[i];
}
else {
int a, b; cin>>a>>b;
cout<<tr[a][b]<<"\n";
}
}
}
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... |