# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
588525 | Nicolaikrob | Scales (IOI15_scales) | C++17 | 2 ms | 304 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() {
int a, b, c, d, e, f, t1, t2;
a = getHeaviest(1, 2, 3);
c = getLightest(1, 2, 3);
for(int i=1;i<4;i++) if(i^a && i^c) b = i;
d = getHeaviest(4, 5, 6);
f = getLightest(4, 5, 6);
for(int i=4;i<7;i++) if(i^d && i^f) e = i;
t1 = getMedian(a, b, d);
t2 = getMedian(c, e, f);
if(t1 == a) {
if(t2 == e) { int W[] = {f, e, c, b, a, d}; answer(W); return; }
if(t2 == c) {
t1 = getMedian(a, b, e);
if(t1 == a) { int W[] = {f, c, b, a, e, d}; answer(W); return; }
if(t1 == b) { int W[] = {f, c, e, b, a, d}; answer(W); return; }
if(t1 == e) { int W[] = {f, c, b, e, a, d}; answer(W); return; }
}
if(t2 == f) {
t1 = getNextLightest(a, e, f, b);
if(t1 == a) {
t1 = getMedian(a, e, f);
if(t1 == a) { int W[] = {c, f, b, a, e, d}; answer(W); return; }
if(t1 == e) { int W[] = {c, f, e, b, a, d}; answer(W); return; }
if(t1 == f) { int W[] = {c, b, a, f, e, d}; answer(W); return; }
}
if(t1 == e) { int W[] = {c, f, b, e, a, d}; answer(W); return; }
if(t1 == f) {
t1 = getHeaviest(a, e, f);
if(t1 == a) { int W[] = {c, b, f, e, a, d}; answer(W); return; }
if(t1 == e) { int W[] = {c, b, f, a, e, d}; answer(W); return; }
}
}
}
if(t1 == d) {
if(t2 == e) { int W[] = {f, e, c, b, d, a}; answer(W); return; }
if(t2 == c) {
t1 = getHeaviest(b, e, f);
if(t1 == b) { int W[] = {f, c, e, b, d, a}; answer(W); return; }
if(t1 == e) { int W[] = {f, c, b, e, d, a}; answer(W); return; }
}
if(t2 == f) {
t1 = getMedian(b, e, f);
if(t1 == b) { int W[] = {c, f, b, e, d, a}; answer(W); return; }
if(t1 == e) { int W[] = {c, f, e, b, d, a}; answer(W); return; }
if(t1 == f) { int W[] = {c, b, f, e, d, a}; answer(W); return; }
}
}
if(t1 == b) {
if(t2 == c) { int W[] = {f, c, e, d, b, a}; answer(W); return; }
if(t2 == e) {
t1 = getHeaviest(c, d, f);
if(t1 == c) { int W[] = {f, e, d, c, b, a}; answer(W); return; }
if(t1 == d) { int W[] = {f, e, c, d, b, a}; answer(W); return; }
}
if(t2 == f) { int W[] = {c, f, e, d, b, a}; answer(W); return; }
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |