# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
158333 | johutha | Scales (IOI15_scales) | C++14 | 2 ms | 504 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 <iostream>
#include <vector>
using namespace std;
void init(int T) {
/* ... */
}
vector<int> sort(int a, int b, int c)
{
vector<int> r;
r.push_back(getLightest(a, b, c));
r.push_back(getMedian(a, b, c));
if (a != r[0] && a != r[1]) r.push_back(a);
else if (b != r[0] && b != r[1]) r.push_back(b);
else r.push_back(c);
return r;
}
void orderCoins()
{
int l1 = getLightest(1, 2, 3);
int l2 = getLightest(4, 5, 6);
int lh;
if (l1 == 1) lh = getLightest(l1, l2, 2);
else lh = getLightest(l1, l2, 1);
vector<int> rst;
for (int i = 1; i < 7; i++) if (i != lh) rst.push_back(i);
int hv = getHeaviest(getHeaviest(rst[0], rst[1], rst[2]), rst[3], rst[4]);
rst.clear();
for (int i = 1; i < 7; i++) if (i != l1 && i != l2 && i != hv) rst.push_back(i);
int sh = getHeaviest(rst[0], rst[1], rst[2]);
rst.clear();
for (int i = 1; i < 7; i++) if (i != lh && i != sh && i != hv) rst.push_back(i);
vector<int> res;
res.push_back(lh);
auto r = sort(rst[0], rst[1], rst[2]);
for (auto i : r) res.push_back(i);
res.push_back(sh);
res.push_back(hv);
answer(res.data());
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |