제출 #1234221

#제출 시각아이디문제언어결과실행 시간메모리
1234221dssfsuper2Street Lamps (APIO19_street_lamps)C++20
20 / 100
99 ms20712 KiB
/* first subtask: simulation, ez second:you just query how many times the thing was on, you can ust count for each one third:you have moements of turning on of each thing, you just wander the max on interval fourth: first calculate the thing, then just min on interval */ #include <bits/stdc++.h> using namespace std; signed main(){ int n, q;cin>>n>>q; string s;cin>>s; vector<int> a; for(int i = 0;i<n;i++){ if(s[i]=='1')a.push_back(1); else a.push_back(0); } vector<vector<int>> events; for(int i = 0;i<q;i++){ string ev;cin>>ev; if(ev=="toggle"){ int x;cin>>x; events.push_back({0, x}); } else{ int x, y;cin>>x>>y; events.push_back({1, x, y}); } } if(n<=200 && q<=200){ vector<vector<int>> strings={a}; for(auto thing:events){ if (thing[0]==0){ a[thing[1]-1]^=1; } else{ int tres = 0; for(auto strin:strings){ bool res = true; for(int i =thing[1]-1;i<thing[2]-1;i++){ if(strin[i]==0)res=false; } if(res)tres++; } cout << tres << '\n'; } strings.push_back(a); } } }
#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...