#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define sp <<" "<<
#define endl "\n"
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
// merge sort thing
vector<int> L = {1, 2, 3}, R = {4, 5, 6};
auto sort3 = [&](vector<int> &X) -> void {
cerr << "query1" sp X[0] sp X[1] sp X[2] << endl;
int A = getLightest(X[0], X[1], X[2]);
int B = getMedian(X[0], X[1], X[2]);
int C;
for (int i = 0; i < 3; i++) {
if (X[i] == A or X[i] == B) continue;
C = X[i];
}
X = {A, B, C};
};
sort3(L), sort3(R);
vector<int> A;
int l = 0, r = 0;
while (l < 3 and r < 3 and l + r < 4) {
int N = (l == 2 ? R[2] : L[2]);
cerr << "query2" sp L[l] sp R[r] sp N << endl;
int X = getLightest(L[l], R[r], N);
if (X == L[l]) l++;
else r++;
A.push_back(X);
}
if (l == 3) {
while (r < 3) {
A.push_back(R[r]);
r++;
}
} else if (r == 3) {
while (l < 3) {
A.push_back(L[l]);
l++;
}
} else {
assert(l == 2 and r == 2);
int N = L[0];
cerr << "query3" sp L[l] sp R[r] sp N << endl;
int X = getHeaviest(L[l], R[r], N);
if (X == L[l]) {
A.push_back(R[r]);
A.push_back(L[l]);
} else {
A.push_back(L[l]);
A.push_back(R[r]);
}
}
int W[6];
for (int i = 0; i < 6; i++) W[i] = A[i];
answer(W);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |