# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154247 | popovicirobert | Scales (IOI15_scales) | C++14 | 8 ms | 376 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() {
vector <int> a, b;
int z = getHeaviest(1, 2, 3), x = getLightest(1, 2, 3);
int y = 6 - x - z;
a = {x, y, z};
z = getHeaviest(4, 5, 6), x = getLightest(4, 5, 6);
y = 15 - x - z;
b = {x, y, z};
int mx = getHeaviest(a[0], a[2], b[2]);
int sol[6], i;
if(mx == a[2]) {
vector <int> pos(3);
for(i = 0; i < 3; i++) {
pos[i] = getNextLightest(a[0], a[1], a[2], b[i]);
}
int p = 0, sz = 0;
for(i = 0; i < 3; i++) {
while(p < 3 && pos[p] == a[i]) {
sol[sz++] = b[p++];
}
sol[sz++] = a[i];
}
}
else {
vector <int> pos(3);
for(i = 0; i < 3; i++) {
pos[i] = getNextLightest(b[0], b[1], b[2], a[i]);
}
int p = 0, sz = 0;
for(i = 0; i < 3; i++) {
while(p < 3 && pos[p] == b[i]) {
sol[sz++] = a[p++];
}
sol[sz++] = b[i];
}
}
answer(sol);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |