Submission #972961

#TimeUsernameProblemLanguageResultExecution timeMemory
972961UnforgettableplStreet Lamps (APIO19_street_lamps)C++17
20 / 100
133 ms4576 KiB
#include <bits/stdc++.h> using namespace std; #define int long long bool state[101]; int ans[101][101]; void compute(){ for(int start = 1;start<=100;start++){ for(int end = start;end<=100;end++){ if(!state[end])break; ans[start][end]++; } } } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n,q; cin >> n >> q; for(int i=1;i<=n;i++){ char a;cin>>a; if(a=='1')state[i]=true; } for(int i=1;i<=q;i++){ compute(); string type;cin>>type; if(type=="toggle"){ int x;cin>>x; state[x] = !state[x]; } else { int l,r;cin>>l>>r; cout << ans[l][r-1] << '\n'; } } }
#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...