# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138870 | dsjong | Sorting (IOI15_sorting) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
int ans[6];
void init(int T){
return;
}
void orderCoins() {
int A=getLightest(1,2,3);
int B=getLightest(4,5,6);
int C;
if(A==1) C=getLightest(A,B,2);
else C=getLightest(A,B,1);
ans[0]=C;
vector<int>v;
for(int i=1;i<=3;i++){
if(C!=i) v.push_back(i);
}
int X=getHeaviest(4,5,6);
X=getHeaviest(X,v[0],v[1]);
ans[5]=X;
v.clear();
for(int i=1;i<=6;i++){
if(i!=X&&i!=A&&i!=B){
v.push_back(i);
}
}
int Y=getHeaviest(v[0],v[1],v[2]);
ans[4]=Y;
int M,N;
v.clear();
for(int i=1;i<=6;i++){
if(i!=X&&i!=Y&&i!=C){
v.push_back(i);
}
}
ans[1]=getLightest(v[0],v[1],v[2]);
ans[3]=getHeaviest(v[0],v[1],v[2]);
for(int i=1;i<=6;i++){
if(i!=ans[1]&&i!=ans[3]&&i!=X&&i!=Y&&i!=C){
ans[2]=i;
}
}
answer(ans);
return;
}