# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1017386 | DorostWef | Scales (IOI15_scales) | C++17 | 1 ms | 600 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;
#define gl getLightest
#define gm getMedian
#define gh getHeaviest
#define gn getNextLightest
void init(int T) {
/* ... */
}
void answe (vector <int> v) {
int a[6];
for (int i = 0; i < 6; i++)
a[i] = v[i];
answer (a);
}
void orderCoins() {
/* ... */
int x, y, z, a, b, c;
x = gl(1, 2, 3);
y = gm(1, 2, 3);
z = x ^ y;
a = gl(4, 5, 6);
b = gm(4, 5, 6);
c = 7 ^ a ^ b;
int w = gn (x, y, z, a);
if (w != x) {
vector <int> v = {x, y, z};
for (int i = 0; i < (int)v.size(); i++) {
if (w == v[i]) {
v.insert (v.begin() + i, a);
break;
}
}
w = gn(x, y, z, b);
if (w != x) {
for (int i = 0; i < (int)v.size(); i++) {
if (w == v[i]) {
v.insert (v.begin() + i, b);
break;
}
}
} else {
v.push_back(b);
}
w = gn(x, y, z, c);
if (w != x) {
for (int i = 0; i < (int)v.size(); i++) {
if (w == v[i]) {
v.insert (v.begin() + i, c);
break;
}
}
} else {
v.push_back(c);
}
answe (v);
return;
} else {
int k = gm (a, b, x);
if (k == a) {
answe ({x, y, z, a, b, c});
return;
} else if (k == b) {
int l = gn (b, x, y, c);
if (l == y) {
answe ({a, b, x, c, y, z});
return;
} else if (l == x) {
answe ({a, b, c, x, y, z});
return;
} else {
if (gm (a, c, z) == c) {
answe ({a, b, x, y, c, z});
return;
} else {
answe ({a, b, x, y, z, c});
return;
}
}
} else {
w = gn (x, y, z, b);
vector <int> v = {a, x, y, z};
if (w == x) {
v.push_back(b);
} else {
for (int i = 0; i < (int)v.size(); i++) {
if (w == v[i]) {
v.insert (v.begin() + i, b);
break;
}
}
}
w = gn (x, y, z, c);
if (w == x) {
v.push_back(c);
} else {
for (int i = 0; i < (int)v.size(); i++) {
if (w == v[i]) {
v.insert (v.begin() + i, c);
break;
}
}
}
answe (v);
return;
}
}
assert (false);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |