# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56068 | aome | Scales (IOI15_scales) | C++17 | 3 ms | 592 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 p[10];
void orderCoins() {
memset(p, 0, sizeof p);
p[1] = getLightest(1, 2, 3);
for (int i = 1; i <= 3; ++i) {
if (i == p[1]) continue;
if (!p[2]) p[2] = i; else p[3] = i;
}
p[4] = getLightest(4, 5, 6);
p[6] = getHeaviest(4, 5, 6);
p[5] = 15 - p[4] - p[6];
int v0 = getNextLightest(p[2], p[3], p[5], p[1]);
if (v0 == p[3]) swap(p[2], p[3]);
if (v0 == p[2]) {
int v1 = getMedian(p[1], p[3], p[5]);
if (v1 == p[1]) {
// 4, 5, 1, 2, 3
int v2 = getNextLightest(p[1], p[2], p[3], p[6]);
if (v2 == p[1]) {
int v3 = getLightest(p[1], p[2], p[6]);
if (v3 == p[6]) {
int res[] = {p[4], p[5], p[6], p[1], p[2], p[3]};
answer(res); return;
}
if (v3 == p[1]) {
int res[] = {p[4], p[5], p[1], p[2], p[3], p[6]};
answer(res); return;
}
}
if (v2 == p[2]) {
int res[] = {p[4], p[5], p[1], p[6], p[2], p[3]};
answer(res); return;
}
if (v2 == p[3]) {
int res[] = {p[4], p[5], p[1], p[2], p[6], p[3]};
answer(res); return;
}
}
if (v1 == p[3]) {
// 1, 2, 3, 5, 6
int v2 = getNextLightest(p[1], p[2], p[3], p[4]);
if (v2 == p[1]) {
int v3 = getLightest(p[1], p[2], p[4]);
if (v3 == p[4]) {
int res[] = {p[4], p[1], p[2], p[3], p[5], p[6]};
answer(res); return;
}
if (v3 == p[1]) {
int res[] = {p[1], p[2], p[3], p[4], p[5], p[6]};
answer(res); return;
}
}
if (v2 == p[2]) {
int res[] = {p[1], p[4], p[2], p[3], p[5], p[6]};
answer(res); return;
}
if (v2 == p[3]) {
int res[] = {p[1], p[2], p[4], p[3], p[5], p[6]};
answer(res); return;
}
}
if (v1 == p[5]) {
// 1, 2, 5, 3
int res[6];
int v2 = getMedian(p[1], p[2], p[4]);
int v3 = getHeaviest(p[3], p[5], p[6]);
if (v2 == p[1]) {
res[0] = p[4], res[1] = p[1], res[2] = p[2];
}
if (v2 == p[2]) {
res[0] = p[1], res[1] = p[2], res[2] = p[4];
}
if (v2 == p[4]) {
res[0] = p[1], res[1] = p[4], res[2] = p[2];
}
res[3] = p[5];
if (v3 == p[3]) {
res[4] = p[6], res[5] = p[3];
}
if (v3 == p[6]) {
res[4] = p[3], res[5] = p[6];
}
answer(res); return;
}
}
if (v0 == p[5]) {
int v1 = getHeaviest(1, 2, 3);
if (v1 == p[2]) swap(p[2], p[3]);
// 1, 5, 2, 3
int res[6];
int v2 = getMedian(p[2], p[3], p[6]);
int v3 = getLightest(p[1], p[4], p[5]);
if (v2 == p[2]) {
res[3] = p[6], res[4] = p[2], res[5] = p[3];
}
if (v2 == p[3]) {
res[3] = p[2], res[4] = p[3], res[5] = p[6];
}
if (v2 == p[6]) {
res[3] = p[2], res[4] = p[6], res[5] = p[3];
}
res[2] = p[5];
if (v3 == p[1]) {
res[0] = p[1], res[1] = p[4];
}
if (v3 == p[4]) {
res[0] = p[4], res[1] = p[1];
}
answer(res); return;
}
assert(0);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |