# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
752529 | phoebe | Scales (IOI15_scales) | C++17 | 1 ms | 220 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 <bits/stdc++.h>
#include "scales.h"
using namespace std;
void init(int t){
// wat why do we need this?
}
void orderCoins(){
// int h[6] = {0};
// answer(h); return;
int x[6];
set<int> rem = {1, 2, 3, 4, 5, 6};
int first_mx = getHeaviest(1, 2, 3);
int second_mx = getHeaviest(4, 5, 6);
x[2] = first_mx; x[5] = second_mx;
rem.erase(first_mx); rem.erase(second_mx);
int a = *rem.begin(), b = *(++rem.begin()),
c = *(++++rem.begin());
int next_mx = getHeaviest(a, b, c);
if (next_mx > 3) swap(x[2], x[5]);
x[1] = next_mx;
rem.erase(next_mx);
a = *rem.begin(), b = *(++rem.begin()),
c = *(++++rem.begin());
int global_mn = getLightest(a, b, c);
x[3] = global_mn; rem.erase(global_mn);
x[0] = *rem.begin(); x[4] = *(++rem.begin());
vector<int> re;
// x[0] > x[3]
int cur = 3;
for (int i = 0; i < 3; i++){
int med = getNextLightest(x[3], x[4], x[5], x[i]);
if (med == x[3]){ // all smaller than x[i]
while (cur < 6) re.push_back(x[cur++]);
}
else{
while (x[cur] != med) re.push_back(x[cur++]);
}
re.push_back(x[i]);
}
while (cur < 6) re.push_back(x[cur++]);
int w[6]; for (int i = 0; i < 6; i++) w[i] = re[i];
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |