Submission #430174

#TimeUsernameProblemLanguageResultExecution timeMemory
430174oscar1fLast supper (IOI12_supper)C++17
0 / 100
101 ms16408 KiB
#include<bits/stdc++.h> #include "advisor.h" using namespace std; const int NB_BITS=13,MAX_COUL=100*1000,INFINI=1000*1000*1000; set<int> date[MAX_COUL]; int pres[MAX_COUL]; set<pair<int,int>> proch; set<int>::iterator it; set<pair<int,int>>::iterator it2; void crypte(int nb) { cout<<nb<<endl; for (int i=0;i<NB_BITS;i++) { if (nb%2==1) { WriteAdvice('1'); } else { WriteAdvice('0'); } nb/=2; } } void ComputeAdvice(int *ajout, int nbCoul, int taille, int tailleMax) { for (int i=0;i<nbCoul;i++) { date[i].insert(INFINI); } for (int i=0;i<nbCoul;i++) { date[ajout[i]].insert(i); } for (int i=0;i<taille;i++) { it=date[i].begin(); proch.insert(make_pair(*it,i)); pres[i]=1; } for (int i=0;i<nbCoul;i++) { if (pres[ajout[i]]==1) { crypte(nbCoul); proch.erase(make_pair(i,ajout[i])); it=date[ajout[i]].lower_bound(i+1); proch.insert(make_pair(*it,ajout[i])); } else { it2=proch.lower_bound(make_pair(INFINI,INFINI)); it2--; crypte((*it2).second); pres[(*it2).second]=0; proch.erase(*it2); it=date[ajout[i]].lower_bound(i+1); pres[ajout[i]]=1; proch.insert(make_pair(*it,ajout[i])); } } }
#include<bits/stdc++.h> #include "assistant.h" using namespace std; const int NB_BITS=13; void Assist(unsigned char *AA, int NN, int KK, int RR) { int nb; for (int i=0;i<NN;i++) { nb=GetRequest(); nb=0; int multi=0; for (int j=NB_BITS*i;j<NB_BITS*(i+1);j++) { if (AA[j]=='1') { nb+=multi; } multi*=2; } if (nb!=NN) { PutBack(nb); } } }
#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...