제출 #834283

#제출 시각아이디문제언어결과실행 시간메모리
834283Antekb가로등 (APIO19_street_lamps)C++17
20 / 100
5063 ms2408 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...