# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713962 | vjudge1 | Scales (IOI15_scales) | C++17 | 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 <bits/stdc++.h>
using namespace std;
void init(int T) {
/* ... */
}
array<int, 3> order3(int a, int b, int c){
int lightest = getLightest(a, b, c);
int med = getMedian(a, b, c);
int heaviest = a ^ b ^ c ^ lightest ^ med;
return {lightest, med, heaviest};
}
void orderCoins() {
//[1, 2, 3] va [4, 5, 6]
array<int, 3> p123 = order3(1, 2, 3);
array<int, 3> p456 = order3(4, 5, 6);
int light34 = getLightest(p123[2], p456[0], p456[1]);
if (light34 == p123[2]){
int W[6] = {p123[0], p123[1], p123[2], p456[0], p456[1], p456[2]};
answer(W);
return;
}
int light16 = getLightest(p456[2], p123[0], p123[1]);
if (light16 == p456[2]){
int W[6] = {p456[0], p456[1], p456[2], p123[0], p123[1], p123[2]};
answer(W);
return;
}
int light25 = getLightest(p123[1], p456[1], p123[2]);
if (light25 == p456[1]){
//(1, 4, 5) (2, 3, 6)
swap(p123, p456);
}
array<int, 3> p124, p356;
int med1 = getMedian(p123[0], p123[1], p456[0]);
if (med1 == p123[0]){
p124 = {p456[0], p123[0], p123[1]};
} else if (med1 == p123[1]){
p124 = {p123[0], p123[1], p456[0]};
} else {
p124 = {p123[0], p456[0], p123[1]};
}
int med2 = getMedian(p123[2], p456[1], p456[2]);
if (med2 == p456[1]){
p356 = {p123[2], p456[1], p456[2]};
} else if (med2 == p456[2]){
p356 = {p456[1], p456[2], p123[2]};
} else {
p356 = {p456[1], p123[2], p456[2]};
}
int W[6] = {p124[0], p124[1], p124[2], p356[0], p356[1], p356[2]};
//p456[0] < p123[2]
//p123[0] < p456[2]
answer(W);
}