Submission #433607

# Submission time Handle Problem Language Result Execution time Memory
433607 2021-06-20T08:19:30 Z oscar1f Street Lamps (APIO19_street_lamps) C++17
20 / 100
686 ms 11744 KB
#include<bits/stdc++.h>
using namespace std;

const int MAX_TAXI=300*1000+2;
int nbLampe,nbReq,pos,nbTaxi,deb,fin;
int ouvert[MAX_TAXI][3];
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][0]=1;
		}
	}
	for (int ireq=1;ireq<=nbReq;ireq++) {
		cin>>typeReq;
		if (typeReq=="toggle") {
			cin>>pos;
			ouvert[pos][2]+=ouvert[pos][0]*(ireq-ouvert[pos][1]);
			ouvert[pos][1]=ireq;
			ouvert[pos][0]=1-ouvert[pos][0];
		}
		else {
			cin>>deb>>fin;
			cout<<ouvert[deb][2]+ouvert[deb][0]*(ireq-ouvert[deb][1])<<endl;
		}
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 322 ms 1376 KB Output is correct
2 Correct 323 ms 4616 KB Output is correct
3 Correct 335 ms 5300 KB Output is correct
4 Correct 349 ms 9636 KB Output is correct
5 Correct 425 ms 10068 KB Output is correct
6 Correct 314 ms 9404 KB Output is correct
7 Correct 657 ms 6816 KB Output is correct
8 Correct 686 ms 11744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -