Submission #433593

#TimeUsernameProblemLanguageResultExecution timeMemory
433593oscar1fStreet Lamps (APIO19_street_lamps)C++17
20 / 100
495 ms4476 KiB
#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; } } }
#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...