| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364795 | mrasool1665 | Street Lamps (APIO19_street_lamps) | C++20 | 5086 ms | 5256 KiB |
//MRasool kheyri
//iran -> khorasan -> ferdows -> Baghestan
//14/2/1405
//vasat azmoonima...
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define el '\n'
const ll maxn = 1e6 + 100 ;
ll n , q , a[maxn] , b[maxn] ;
void solve(){
cin>>n>>q ;
for(ll i = 0 ; i < n ; i++){
char ch ;
cin>>ch ;
a[i] = ch-'0' ;
}
vector<ll> vec ;
for(ll _ = 0 ; _ < q ; _++){
string s ;
cin>>s ;
if(s == "query"){
ll l , r ;
cin>>l>>r ;
l-- , r-- ;
for(ll i = 0 ; i < n ; i++){
b[i] = a[i] ;
}
ll ans = 0 ;
ll ok = 1 ;
for(ll i = l ; i < r ; i++){
if(!b[i]){
ok = 0 ;
}
}
ans += ok ;
for(auto x : vec){
if(x != -1){
b[x] = 1-b[x] ;
}
ll ok = 1 ;
for(ll i = l ; i < r ; i++){
if(!b[i]){
ok = 0 ;
}
}
ans += ok ;
}
cout<<ans<<el ;
vec.push_back(-1) ;
}
else{
ll x ;
cin>>x ;
x-- ;
vec.push_back(x) ;
}
}
return ;
}
int main(){
ios_base::sync_with_stdio(0) , cin.tie(nullptr) , cout.tie(nullptr) ;
ll t = 1 ;
//cin>>t ;
while(t--){
solve() ;
}
return 0 ;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
