# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
384662 | qpwoeirut | Scales (IOI15_scales) | C++17 | 1 ms | 364 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() {
int W[] = {1, 2, 3, 4, 5, 6};
int mn1 = getLightest(1, 2, 3);
int mn2 = getLightest(4, 5, 6);
int other = 1;
for (; other<=6 && (mn1 == other || mn2 == other); ++other);
assert(mn1 != other && mn2 != other);
W[0] = getLightest(mn1, mn2, other);
vector<int> coins;
for (int i=1; i<=6; ++i) if (i != W[0]) coins.push_back(i);
assert(coins.size() == 5);
mn1 = getLightest(coins[0], coins[1], coins[2]);
W[1] = getLightest(coins[3], coins[4], mn1);
coins.erase(find(coins.begin(), coins.end(), W[1]));
mn1 = getLightest(coins[0], coins[1], coins[2]);
W[2] = getLightest(coins[3], mn1, coins[0] == mn1 ? coins[1] : coins[0]);
coins.erase(find(coins.begin(), coins.end(), W[2]));
assert(coins.size() == 3);
W[3] = getLightest(coins[0], coins[1], coins[2]);
W[4] = getMedian(coins[0], coins[1], coins[2]);
for (int i=0; i<3; ++i) {
if (coins[i] != W[3] && coins[i] != W[4]) W[5] = coins[i];
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |