# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
268586 | A02 | 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.
#include "scales.h"
#include <vector>
#include <set>
#include <algorithm>
#include <utility>
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
int l1 = getLightest(1, 2, 3);
int l2 = getLightest(4, 5, 6);
int s = 1;
if (1 == l1){
s = 2;
}
int l = getLightest(l1, l2, s);
vector<int> remaining;
for (int i = 1; i <= 6; i++){
if (i != l){
remaining.push_back(i);
}
}
int l1 = getNextLightest(remaining[0], remaining[1], remaining[2], l);
int l2 = getNextLightest(remaining[4], remaining[5], l1, l);
W[0] = l;
W[1] = l2;
remaining.erase(remaining.find(l2));
int l3 = getNextLightest(remaining[0], remaining[1], remaining[2], l2);
int l4 = getNextLightest(remaining[3], l, l3, l2);
W[2] = l4;
remaining.erase(remaining.find(l4));
int l5 = getNextLightest(remaining[0], remaining[1], remaining[2], l3);
W[3] = l5;
W[4] = getMedian(remaining[0], remaining[1], remaining[2]);
remaining.erase(remaining.find(W[3]));
remaining.erase(remaining.find(W[4]));
W[5] = remaining[0];
answer(W);
}