#include <iostream>
using namespace std;
int N,Q;
string S;
bool A[300001];
int Ans[300001];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>N>>Q>>S;
for (int i=1; i<=N; i++)
A[i]=(S[i-1]=='1');
for (int t=1; t<=Q; t++){
string s;
cin>>s;
if (s[0]=='t'){
int x;
cin>>x;
if (A[x])
Ans[x]+=t;
else
Ans[x]-=t;
A[x]^=true;
}
else{
int l,r;
cin>>l>>r;
cout<<Ans[l]+(A[l]?t:0)<<"\n";
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
48 ms |
4440 KB |
Output is correct |
2 |
Correct |
51 ms |
4904 KB |
Output is correct |
3 |
Correct |
53 ms |
5204 KB |
Output is correct |
4 |
Correct |
63 ms |
8316 KB |
Output is correct |
5 |
Correct |
65 ms |
8416 KB |
Output is correct |
6 |
Correct |
55 ms |
7908 KB |
Output is correct |
7 |
Correct |
72 ms |
7652 KB |
Output is correct |
8 |
Correct |
81 ms |
9312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |