Submission #433607

#TimeUsernameProblemLanguageResultExecution timeMemory
433607oscar1fStreet Lamps (APIO19_street_lamps)C++17
20 / 100
686 ms11744 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...