# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
588530 | Siffer | Scales (IOI15_scales) | C++14 | 1 ms | 212 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) {
//
}
void orderCoins() {
vector<int> W;
int a = getLightest(1, 2, 3);
int b = (a==1)?2:1;
int c = (a==1)?3:2^3^a;
int d = getHeaviest(b,c,4);
if(d==4) {
if(b==getNextLightest(a,b,d,c)) swap(b,c);
} else {
int k = d;
d = 4;
if(k==b) swap(d,b), swap(b,c);
else swap(d,c);
k = getNextLightest(a,b,d,c);
if(k==a) swap(a,c);
if(k!=d) swap(b,c);
}
int e = 5;
int k = getNextLightest(a,b,c,5);
if(k==a) {
k = getMedian(a,d,e);
if(k==e) swap(d,e);
if(k==a) swap(a,e), swap(b,e), swap(c,e), swap(d,e);
} else {
if(k==b) swap(e,b);
swap(e, c);
swap(e, d);
}
int f = 6;
k = getNextLightest(a,b,e,f);
if(k==b) W = {a,f,b,c,d,e};
else if(k==a) {
k = getMedian(a,e,f);
if(k==a) W = {f,a,b,c,d,e};
else W = {a,b,c,d,e,f};
}
else if(k==e) {
k = getMedian(c,d,f);
if(k==c) W = {a,b,f,c,d,e};
else if(k==f) W = {a,b,c,f,d,e};
else W = {a,b,c,d,f,e};
}
//cout << W[0] << " " << W[1] << " " << W[2] << " " << W[3] << " " << W[4] << " " << W[5] << endl;
int ANS[] = {W[0], W[1], W[2], W[3], W[4], W[5]};
answer(ANS);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |