# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1182079 | tgirolami09 | Carnival (CEOI14_carnival) | C++20 | 25 ms | 408 KiB |
#include <iostream>
#include <vector>
using namespace std;
int main(){
int nbPeople;
scanf("%d",&nbPeople);
vector<int> answer(nbPeople,-1);
printf("%d ",nbPeople);
for (int i = 0;i<nbPeople;++i){
printf("%d ",i+1);
}
printf("\n");
fflush(stdout);
int nbTotalCostumes;
scanf("%d",&nbTotalCostumes);
//Ceux qui reste sont de la derniere couleur
for (int currentCostume = 1;currentCostume<nbTotalCostumes;++currentCostume){
int firstOfCostume;
for (int idx = 0;idx<nbPeople;++idx){
if (answer[idx]==-1){
answer[idx] = currentCostume;
firstOfCostume = idx;
break;
}
}
for (int other = firstOfCostume+1;other<nbPeople;++other){
if (answer[other]==-1){
printf("2 %d %d\n",firstOfCostume+1,other+1);
fflush(stdout);
int nbCostumes;
scanf("%d",&nbCostumes);
if (nbCostumes==1){
answer[other] = answer[firstOfCostume];
}
}
}
}
printf("0 ");
for (int i : answer){
int toPrint = i;
if (toPrint==-1){
toPrint = nbTotalCostumes;
}
printf("%d ",toPrint);
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |