# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
292357 | VodkaInTheJar | Scales (IOI15_scales) | C++14 | 1 ms | 384 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)
{
}
vector <int> merge(vector <int> v, int x)
{
int sz = (int)v.size();
vector <int> ans;
if (sz == 2)
{
int temp = getMedian(v[0], v[1], x);
if (temp == x)
return {v[0], x, v[1]};
else
if (temp == v[0])
return {x, v[0], v[1]};
else
return {v[0], v[1], x};
}
int temp = getHeaviest(v[sz-2], v[sz-1], x);
if (temp == x)
{
ans = v;
ans.push_back(x);
return ans;
}
else
{
int pre = v[sz-1];
v.pop_back();
ans = merge(v, x);
ans.push_back(pre);
return ans;
}
}
int shit[6];
void orderCoins()
{
vector <int> ans;
ans.push_back(getLightest(1, 2, 3));
ans.push_back(getMedian(1, 2, 3));
if (ans[0] != 1 && ans[1] != 1)
ans.push_back(1);
if (ans[0] != 2 && ans[1] != 2)
ans.push_back(2);
if (ans[0] != 3 && ans[1] != 3)
ans.push_back(3);
for (int i = 4; i <= 6; i++)
ans = merge(ans, i);
for (int i = 0; i < 6; i++)
shit[i] = ans[i];
answer(shit);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |