Submission #675829

# Submission time Handle Problem Language Result Execution time Memory
675829 2022-12-28T06:16:09 Z Dan4Life Street Lamps (APIO19_street_lamps) C++17
20 / 100
7 ms 2356 KB
#include <bits/stdc++.h>
using namespace std;

const int maxn = (int)3e5+10;

string s;
int a[maxn], st[101][maxn];
int n, q;

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'), st[0][i]=a[i];

	for(int i = 1; i <= q; i++){
		int x, y; cin >> s >> x;
		if(s[0]=='t'){
			a[x]^=1;
		}
		else{
			cin >> y; int ans = 0;
			for(int j = 0; j < i; j++){
				bool ok = true;
				for(int k = x; k < y; k++) ok&=(st[j][k]==1);
				ans+=ok;
			}
			cout << ans << "\n";
		}
		for(int j = 1; j <= n; j++) st[i][j] = a[j];
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 964 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 968 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 1620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 2304 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 2356 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 596 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 964 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 968 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Runtime error 6 ms 1620 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -