# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
30541 | ozaslan | Scales (IOI15_scales) | C++14 | 0 ms | 1120 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"
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[] = {0, 0, 0, 0, 0, 0};
int b1, o1, k1, b2, o2, k2;
b1 = getHeaviest(1, 2, 3);
o1 = getMedian(1, 2, 3);
k1 = 6 - (b1 + o1);
b2 = getHeaviest(4, 5, 6);
o2 = getMedian(4, 5, 6);
k2 = 15 - (b2 + o2);
int o = getMedian(b1, b2, o1);
if (o == o1) {
W[5] = b1;
W[4] = o1;
o = getMedian(b2, o2, k1);
if (o = b2) {
W[3] = k1;
W[2] = b2;
W[1] = o2;
W[0] = k2;
answer(W);
return;
}
if (o == k1) {
W[3] = b2;
W[2] = k1;
W[1] = o2;
W[0] = k2;
answer(W);
return;
}
W[3] = b2;
W[2] = o2;
int ek = getLightest(k1, k2, o2);
W[1] = (ek == k1) ? k2 : k1;
W[0] = ek;
}
else if (o == b1) {
W[5] = b2;
o = getMedian(b1, o1, o2);
if (o == b1) {
W[4] = o2;
o = getMedian(b1, o1, k2);
if (o == b1) {
W[3] = k2;
W[2] = b1;
W[1] = o1;
W[0] = k1;
answer(W);
return;
}
if (o == k2) {
W[3] = b1;
W[2] = k2;
W[1] = o1;
W[0] = k1;
answer(W);
return;
}
W[3] = b1;
W[2] = o1;
int ek = getMedian(k1, k2, o2);
W[1] = (ek == k1) ? k2 : k1;
W[0] = (ek == k1) ? k1 : k2;
answer(W);
return;
}
}
else if (o == b2) {
W[5] = b1;
o = getMedian(b2, o2, o1);
if (o == b2) {
W[4] = o1;
o = getMedian(b2, o2, k1);
if (o == b2) {
W[3] = k1;
W[2] = b2;
W[1] = o2;
W[0] = k2;
answer(W);
return;
}
if (o == k1) {
W[3] = b2;
W[2] = k1;
W[1] = o2;
W[0] = k2;
answer(W);
return;
}
W[3] = b2;
W[2] = o2;
int ek = getMedian(k2, k1, o1);
W[1] = (ek == k2) ? k1 : k2;
W[0] = (ek == k2) ? k2 : k1;
answer(W);
return;
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |