# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
472001 | nicholask | Scales (IOI15_scales) | C++14 | 1 ms | 204 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,r3;
void orderCoins() {
vector <int> ans;
r1=getMedian(1,2,3);
r2=getNextLightest(1,2,3,4);
int n1=(r1==1?2:1);
int n2=6-r1-n1;
if (r1==r2){
r3=getLightest(1,2,3);
if (r3==n1){
ans.push_back(n1);
ans.push_back(4);
ans.push_back(r1);
ans.push_back(n2);
} else {
ans.push_back(n2);
ans.push_back(4);
ans.push_back(r1);
ans.push_back(n1);
}
} else if (r2==n1){
r3=getMedian(4,n1,r1);
if (r3==4){
ans.push_back(n2);
ans.push_back(r1);
ans.push_back(4);
ans.push_back(n1);
} else if (r3==n1){
ans.push_back(4);
ans.push_back(n1);
ans.push_back(r1);
ans.push_back(n2);
} else {
ans.push_back(n1);
ans.push_back(r1);
ans.push_back(n2);
ans.push_back(4);
}
} else {
r3=getMedian(4,n1,n2);
if (r3==4){
ans.push_back(n1);
ans.push_back(r1);
ans.push_back(4);
ans.push_back(n2);
} else if (r3==n1){
ans.push_back(n2);
ans.push_back(r1);
ans.push_back(n1);
ans.push_back(4);
} else {
ans.push_back(4);
ans.push_back(n2);
ans.push_back(r1);
ans.push_back(n1);
}
}
r1=getNextLightest(ans[0],ans[2],ans[3],5);
if (r1==ans[0]){
r1=getLightest(5,ans[0],ans[1]);
if (r1==5) ans.insert(ans.begin(),5);
else ans.push_back(5);
} else if (r1==ans[2]){
r1=getLightest(5,ans[1],ans[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(ans[0],ans[2],ans[4],6);
if (r1==ans[0]){
r1=getLightest(6,ans[0],ans[1]);
if (r1==6) ans.insert(ans.begin(),6);
else ans.push_back(6);
} else if (r1==ans[2]){
r1=getLightest(6,ans[1],ans[2]);
if (r1==6) ans.insert(ans.begin()+1,6);
else ans.insert(ans.begin()+2,6);
} else {
r1=getLightest(6,ans[3],ans[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);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |