#include "scales.h"
#include<bits/stdc++.h>
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int lo = getLightest(1,2,3);
lo = getLightest(lo,4,5);
if(lo != 5){
lo = getLightest(lo,5,6);
}else{
lo = getLightest(lo,4,6);
}
int pt = 1;
int ans[] = {lo,-1,-1,-1,-1,-1};
set<int> left;
for(int i = 1; i <= 6; i++){
left.insert(i);
}
left.erase(lo);
for(int k = 0; k < 4; k++){
vector<int> notLo;
for(int i = 1; i <= 6; i++){
if(i == lo) continue;
notLo.push_back(i);
}
int nlo1 = getNextLightest(notLo[0],notLo[1],notLo[2],lo);
int nlo2 = getNextLightest(notLo[3],notLo[4],notLo[0],lo);
int nlo = -1;
if(nlo1 == nlo2){
nlo = nlo1;
}else{
nlo = getMedian(lo,nlo1,nlo2);
}
lo = nlo;
ans[pt++] = lo;
left.erase(lo);
}
ans[5] = *left.begin();
answer(ans);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |