제출 #549210

#제출 시각아이디문제언어결과실행 시간메모리
549210ala2가로등 (APIO19_street_lamps)C++14
0 / 100
176 ms1300 KiB
#include <bits/stdc++.h> #define int long long #define pb push_back using namespace std; map<int,int>m; map<int,int>l; map<int,int>on; string s; int n,T; int bit(int i) { return s[i]=='1'; } char f(char x) { if(x=='1') { return '0'; } else return '1'; } signed main() { cin>>n>>T; cin>>s; for(int i=0;i<n;i++) { if(s[i]=='1') on[i]=1; } for(int q=1;q<=T;q++) { string c; cin>>c; if(c[0]=='q') { int a,b; cin>>a>>b; a--; m[a]+=(q-l[a])*on[a]; // cout<<" "<<q<<" "<<l[a]<<" "<<on[a]<<" "<<m[a]<<endl; l[a]=q; } else { int i; cin>>i; i--; if(on[i]) { m[i]+=(q-l[i]); } on[i]=1-on[i]; l[i]=q; } } } // 1 /* 6 10 101101 q 3 4 1 t 2 111101 q 3 4 3 q 2 3 3 t 1 011101 q 1 2 4 t 5 011111 t 6 011110 q 5 6 3 q 6 7 7 6 10 101101 q 3 4 t 2 q 3 4 q 2 3 t 1 q 1 2 t 5 t 6 q 5 6 q 6 7 */
#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...