#include <bits/stdc++.h>
#include "scales.h"
using namespace std;
int tt;
void init(int T){
tt=T;
}
vector<int> exclude(vector<int> a, vector<int> b){
for(auto c:b){
a.erase(find(a.begin(), a.end(), c));
}
return a;
}
void orderCoins(){
int a=getLightest(1,2,3), b=getLightest(4,5,6), c=getLightest(a,b,a==3?2:a==2?1:3); // 3 queries
vector<int> d;
vector<bool> used(7,false);
used[c]=true;
if(c==1||c==2||c==3){
d=exclude({1,2,3,b},{a});
}else{
d=exclude({4,5,6,a},{b});
}
int e=getLightest(d[0], d[1], d[2]); // 1 querie
used[e]=true;
vector<int> f=exclude({1,2,3,4,5,6}, {c,e}); // me van a quedar 4 opciones A B C D
int g=getLightest(f[0],f[1],f[2]), h=getLightest(g,f[3],g==f[2]?f[1]:g==f[1]?f[0]:f[2]);
used[h]=true;
vector<int> j=exclude(f,{h});
int k=getLightest(j[0],j[1],j[2]);
used[k]=true;
int l=getMedian(j[0],j[1],j[2]);
used[l]=true;
int m;
for(int i=1;i<=6;i++)if(!used[i])m=i;
int W[6]={c,e,h,k,l,m};
answer(W);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |