# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
471996 | nicholask | Scales (IOI15_scales) | 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;
void init(int T){}
int r1,r2;
void orderCoins() {
vector <int> ans;
r1=getHeaviest(1,2,3);
r2=getLightest(1,2,3);
ans.push_back(r2);
ans.push_back(6-r1-r2);
ans.push_back(r1);
r1=getNextLightest(v[0],v[1],v[2],4);
if (r1==v[0]){
r1=getLightest(4,v[0],v[1]);
if (r1==4) ans.insert(ans.begin(),4);
else ans.push_back(4);
} else if (r1==v[1]){
ans.insert(ans.begin()+1,4);
} else {
ans.insert(ans.begin()+2,4);
}
r1=getNextLightest(v[0],v[2],v[3],5);
if (r1==v[0]){
r1=getLighest(5,v[0],v[1]);
if (r1==5) ans.insert(ans.begin(),5);
else ans.push_back(5);
} else if (r1==v[2]){
r1=getLightest(5,v[1],v[2]);
if (r1==5) ans.insert(ans.begin()+1,5);
else ans.insert(ans.begin()+2,5);
} else {
ans.insert(ans.begin()+3,5);
}
r1=getNextLightest(v[0],v[2],v[4]);
if (r1==v[0]){
r1=getLightest(6,v[0],v[1]);
if (r1==6) ans.insert(ans.begin(),6);
else ans.push_back(6);
} else if (r1==v[2]){
r1=getLightest(6,v[1],v[2]);
if (r1==6) ans.insert(ans.begin()+1,6);
else ans.insert(ans.begin()+2,6);
} else {
r1=getLightest(6,v[3],v[4]);
if (r1==6) ans.insert(ans.begin()+3,6);
else ans.insert(ans.begin()+4,6);
}
int W[6];
for (int i=0; i<6; i++) W[i]=ans[i];
answer(W);
}