Submission #902440

# Submission time Handle Problem Language Result Execution time Memory
902440 2024-01-10T12:08:56 Z Trisanu_Das Street Lamps (APIO19_street_lamps) C++17
20 / 100
83 ms 12016 KB
#include <bits/stdc++.h>
using namespace std;
 
const int maxn = (int)3e5+10;
 
string s;
int n, q, a[maxn], cnt[maxn], t[maxn];

int32_t main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> q >> s;
	for(int i = 1; i <= n; i++){
		a[i] = (s[i-1] == '1');
		t[i] = (a[i] == 1 ? 0 : -1);
	}
	for(int i = 1; i <= q; i++){
		int x, y; cin >> s >> x;
		if(s[0]=='t'){
			a[x] ^= 1;
			if(a[x]) t[x] = i;
			else cnt[x] += i - t[x];
		}
		else cin >> y, cout << cnt[x] + a[x] * (i - t[x]) << "\n";
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 48 ms 4408 KB Output is correct
2 Correct 63 ms 4692 KB Output is correct
3 Correct 59 ms 5456 KB Output is correct
4 Correct 66 ms 10020 KB Output is correct
5 Correct 78 ms 10408 KB Output is correct
6 Correct 67 ms 9956 KB Output is correct
7 Correct 73 ms 10600 KB Output is correct
8 Correct 83 ms 12016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -