# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
796596 | TheSahib | Scales (IOI15_scales) | C++14 | 1 ms | 304 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) {
/* ... */
}
vector<int> v = {1, 2, 3, 4, 5 , 6};
void erase(int a){
v.erase(find(v.begin(), v.end(), a));
}
void orderCoins() {
v.resize(6);
iota(v.begin(), v.end(), 1);
int mx1 = getHeaviest(1, 2, 3);
int mx2 = getHeaviest(4, 5, 6);
erase(mx1);
erase(mx2);
v.push_back(mx1);
v.push_back(mx2);
int mx3 = getHeaviest(v[5], v[4], v[3]);
int md1 = getMedian(v[5], v[4], v[3]);
erase(mx3);
erase(md1);
v.push_back(md1);
v.push_back(mx3);
int mn1 = getLightest(v[0], v[1], v[2]);
int md2 = getMedian(v[0], v[1], v[2]);
erase(mn1);
erase(md2);
v.insert(v.begin(), md2);
v.insert(v.begin(), mn1);
int a = v[3], b = v[4], c = v[5];
for (int i = 0; i < 3; i++)
{
int idx = getNextLightest(a, b, c, v[0]);
v.insert(find(v.begin(), v.end(), idx), v[0]);
v.erase(v.begin());
}
int ans[6];
for (int i = 0; i < 6; i++)
{
ans[i] = v[i];
}
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |