답안 #335105

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
335105 2020-12-11T07:04:42 Z nicholask 가로등 (APIO19_street_lamps) C++14
20 / 100
1 ms 364 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,q;
	cin>>n>>q;
	if (n<=100&&q<=100){
		vector <string> v;
		string st;
		cin>>st;
		v.push_back(st);
		for (int z=1; z<=q; z++){
			string s;
			cin>>s;
			if (s=="toggle"){
				int u;
				cin>>u;
				u--;
				if (st[u]=='0') st[u]='1';
				else st[u]='0';
			} else {
				int t,u;
				cin>>t>>u;
				t--;
				u--;
				int cnt=0;
				for (auto&i:v){
					bool ok=1;
					for (int j=t; j<u; j++){
						if (i[j]!='1'){
							ok=0;
							break;
						}
					}
					if (ok) cnt++;
				}
				cout<<cnt<<endl;
			}
			v.push_back(st);
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Incorrect 0 ms 364 KB Output isn't correct
9 Halted 0 ms 0 KB -