제출 #724518

#제출 시각아이디문제언어결과실행 시간메모리
724518n0sk1ll가로등 (APIO19_street_lamps)C++14
20 / 100
5075 ms9704 KiB
#include <bits/stdc++.h> #define FAST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cerr.tie(0) #define mp make_pair #define xx first #define yy second #define pb push_back #define pf push_front #define popb pop_back #define popf pop_front #define all(x) x.begin(),x.end() #define ff(i,a,b) for (int i = a; i < b; i++) #define fff(i,a,b) for (int i = a; i <= b; i++) #define bff(i,a,b) for (int i = b-1; i >= a; i--) #define bfff(i,a,b) for (int i = b; i >= a; i--) using namespace std; long double typedef ld; unsigned int typedef ui; long long int typedef li; pair<int,int> typedef pii; pair<li,li> typedef pli; pair<ld,ld> typedef pld; vector<vector<int>> typedef graph; unsigned long long int typedef ull; //const int mod = 998244353; const int mod = 1000000007; //Note to self: Check for overflow void solvebrute(int n, string &s, int q, vector<pii> &qrys) { vector<string> verzije; verzije.pb(s); for (auto it : qrys) { if (it.xx>-1) { int kolko=0; for (auto s : verzije) { bool moze=true; ff(i,it.xx-1,it.yy-1) if (s[i]=='0') moze=false; if (moze) kolko++; } cout<<kolko<<"\n"; } verzije.pb(verzije.back()); if (it.xx==-1) verzije.back()[it.yy-1]='0'+'1'-verzije.back()[it.yy-1]; } } void solvepoints(int n, string &s, int q, vector<pii> &qrys) { } void solvepersistent(int n, string &s, int q, vector<pii> &qrys) { } int main() { FAST; int n,q; cin>>n>>q; string s; cin>>s; vector<bool> pomcina(n+3,0); bool susedni=true; bool imaoff=false; vector<pii> qrys; //a,b znaci a,b; -1,i znaci toggle i while (q--) { string tip; cin>>tip; if (tip=="toggle") { int i; cin>>i; qrys.pb({-1,i}); if (s[i-1]=='1' || pomcina[i-1]) imaoff=true; pomcina[i-1]=true; } else { int a,b; cin>>a>>b; qrys.pb({a,b}); if (b-a>1) susedni=false; } } if (n<=100 && q<=100) solvebrute(n,s,q,qrys); else if (susedni) solvepoints(n,s,q,qrys); else if (!imaoff) solvepersistent(n,s,q,qrys); } //Note to self: Check for overflow
#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...