Submission #952977

#TimeUsernameProblemLanguageResultExecution timeMemory
952977Vladth11Street Lamps (APIO19_street_lamps)C++14
20 / 100
5067 ms20236 KiB
#include <bits/stdc++.h> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " #pragma GCC optimize ("Ofast") #pragma GCC target ("avx2") using namespace std; typedef long long ll; typedef pair <ll, ll> pii; const ll NMAX = 300001; const int INF = 1e9; const ll nrbits = 20; const ll MOD = 998244353; int a[NMAX]; string s[NMAX]; int qa[NMAX]; int qb[NMAX]; int sol[NMAX]; signed main() { #ifdef HOME ifstream cin(".in"); ofstream cout(".out"); #endif // HOME ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, i, q; cin >> n >> q; for(i = 1; i <= n; i++){ char c; cin >> c; a[i] = c - '0'; } for(i = 1; i <= q; i++){ cin >> s[i]; cin >> qa[i]; if(s[i][0] == 'q'){ cin >> qb[i]; qb[i]--; } } for(i = 1; i <= q; i++){ for(int j = i; j <= q; j++){ int ok = 1; for(int t = qa[j]; t <= qb[j]; t++){ ok &= (a[t] == 1); } if(ok){ sol[j]++; } } if(s[i][0] == 't'){ a[qa[i]] ^= 1; } if(s[i][0] == 'q') cout << sol[i] << "\n"; } return 0; }
#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...