#include <iostream>
#include <vector>
using namespace std;
int main()
{
int n, q;
cin >> n >> q;
string S;
cin >> S;
bool on[n+1];
for(int i = 1; i <= n; i++) on[i] = S[i-1] == '1';
int A, B;
vector<int> drive(n+1, 0);
for(int i = 1; i <= q; i++)
{
for(int a = 1; a <= n; a++) if(on[a]) drive[a]++;
cin >> S;
if(S == "toggle")
{
cin >> A;
on[A] = !on[A];
}
else
{
cin >> A >> B;
cout << drive[A] << '\n';
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
745 ms |
1296 KB |
Output is correct |
2 |
Correct |
888 ms |
1588 KB |
Output is correct |
3 |
Execution timed out |
5036 ms |
4184 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |