# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1182070 | tgirolami09 | Carnival (CEOI14_carnival) | C++20 | 26 ms | 408 KiB |
#include <iostream>
#include <vector>
using namespace std;
int main(){
int nbPeople;
scanf("%d",&nbPeople);
vector<int> answer(nbPeople,-1);
int currentCostume = 1;
for (int idx = 0;idx<nbPeople;++idx){
if (answer[idx]==-1){
answer[idx] = currentCostume;
++currentCostume;
for (int other = idx+1;other<nbPeople;++other){
if (answer[other]==-1){
printf("2 %d %d\n",idx+1,other+1);
fflush(stdout);
int nbCostumes;
scanf("%d",&nbCostumes);
if (nbCostumes==1){
answer[other] = answer[idx];
}
}
}
}
}
printf("0 ");
for (int i : answer){
printf("%d ",i);
}
}
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... |