#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
// why not writing them manually without for loops?
// let's try (they are small)
vector<int> pos(7);
for(int i = 0; i < 6; i++)
pos[i + 1] = i;
int x = getLightest(W[0], W[1], W[2]);
swap(W[0], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
x = getLightest(W[0], W[3], W[4]);
swap(W[0], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
x = getLightest(W[0], W[4], W[5]);
swap(W[0], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
x = getLightest(W[1], W[2], W[3]);
swap(W[1], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
x = getLightest(W[1], W[4], W[5]);
swap(W[1], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
x = getLightest(W[2], W[3], W[4]);
swap(W[2], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
x = getLightest(W[2], W[4], W[5]);
swap(W[2], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
x = getLightest(W[3], W[4], W[5]);
swap(W[3], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
x = getMedian(W[3], W[4], W[5]);
swap(W[4], W[pos[x]]);
swap(pos[W[pos[x]]], pos[x]);
answer(W);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |