답안 #983733

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983733 2024-05-16T03:11:51 Z pcc 가로등 (APIO19_street_lamps) C++17
20 / 100
1 ms 476 KB
#include <bits/stdc++.h>
using namespace std;

const int mxn = 555;
string s;
string state[mxn];
int N,Q;

bool check(string &s,int a,int b){
	for(int i = a;i<b;i++){
		if(s[i] == '0')return false;
	}
	return true;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>Q;
	if(N>mxn||Q>mxn)return 0;
	cin>>s;
	s = "#"+s;
	state[0] = s;
	for(int i = 1;i<=Q;i++){
		string tp;
		cin>>tp;
		state[i] = state[i-1];
		if(tp[0] == 'q'){
			int a,b;
			cin>>a>>b;
			int ans = 0;
			for(int j = 0;j<i;j++){
				if(check(state[j],a,b))ans++;
			}
			cout<<ans<<'\n';
		}
		else{
			int a;
			cin>>a;
			state[i][a] = (state[i][a] == '0'?'1':'0');
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 476 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 476 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Incorrect 0 ms 344 KB Output isn't correct
9 Halted 0 ms 0 KB -