답안 #675829

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
675829 2022-12-28T06:16:09 Z Dan4Life 가로등 (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];
	}
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 1620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 2304 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 2356 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -