답안 #433593

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
433593 2021-06-20T08:06:43 Z oscar1f 가로등 (APIO19_street_lamps) C++17
20 / 100
495 ms 4476 KB
#include<bits/stdc++.h>
using namespace std;

const int MAX_TAXI=102;
int nbLampe,nbReq,pos,nbTaxi,deb,fin;
int ouvert[MAX_TAXI],rep[MAX_TAXI][MAX_TAXI];
char carac;
string typeReq;

int main() {
	ios_base::sync_with_stdio(false);
	cin>>nbLampe>>nbReq;
	nbTaxi=nbLampe+1;
	for (int i=1;i<=nbLampe;i++) {
		cin>>carac;
		if (carac=='1') {
			ouvert[i]=1;
		}
	}
	for (int ireq=0;ireq<nbReq;ireq++) {
		for (int ideb=1;ideb<nbTaxi;ideb++) {
			pos=ideb;
			while (pos<=nbTaxi) {
				rep[ideb][pos]++;
				if (ouvert[pos]==0) {
					pos=nbTaxi+1;
				}
				else {
					pos++;
				}
			}
		}
		cin>>typeReq;
		if (typeReq=="toggle") {
			cin>>pos;
			ouvert[pos]=1-ouvert[pos];
		}
		else {
			cin>>deb>>fin;
			cout<<rep[deb][fin]<<endl;
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 495 ms 4476 KB Output is correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 495 ms 4476 KB Output is correct
9 Incorrect 1 ms 332 KB Output isn't correct
10 Halted 0 ms 0 KB -