# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
914206 | Itamar | Scales (IOI15_scales) | C++14 | 0 ms | 0 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.
void init(int T) {
}
#include "scales.h"
#include <vector>
using namespace std;
#define vi vector<int>
#include <set>
#include <algorithm>
void orderCoins() {
vi v;
v.push_back(getLightest(1, 2, 3));
v.push_back(getMedian(1, 2, 3));
v.push_back(v[0] ^ v[1]);
for (int i = 4; i <= 6; i++) {
vi vt;
int an = getMedian(v[1], v[2], i);
int in;
if (an == i) {
in = 2;
}
else if(an==v[1]) {
int ant = getMedian(v[0], v[1], i);
if (ant == v[0]) {
in = 0;
}
else in = 1;
}
else {
int ant = getMedian(v[i - 3], v[i - 2], i);
if (ant == i)in = i - 2;
else if (ant == v[i - 2])in = i - 1;
else in = i - 3;
}
for (int j = 0; j < in; j++)vt.push_back(v[j]);
vt.push_back(i);
for (int j = in; j < i-1; j++)vt.push_back(v[j]);
v = vt;
}
int c[6];
for (int i = 0; i < 6; i++)c[i] = v[i];
answer(c);
}