# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290843 | arayi | Scales (IOI15_scales) | C++17 | 1 ms | 256 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"
#define vii vector <int>
#define ad push_back
using namespace std;
void init(int T) {
}
int a[6];
vii fp[7];
void orderCoins() {
a[0] = getLightest(1, 2, 3);
a[1] = getMedian(1, 2, 3);
a[2] = 6 - a[0] - a[1];
a[3] = getLightest(4, 5, 6);
a[4] = getMedian(4, 5, 6);
a[5] = 15 - a[3] - a[4];
//9cout << a[0] << a[1] << a[2] << endl << a[3] << a[4] << a[5] << endl;
int sm;
sm = getNextLightest(1, 2, 3, a[4]);
if(sm == a[0])
{
if(getLightest(a[0], a[1], a[4]) == a[0])
{
fp[4].ad(a[4]);
fp[4].ad(a[5]);
sm = getNextLightest(1, 2, 3, a[3]);
if(sm == a[0])
{
if(getLightest(a[0], a[1], a[3]) == a[0]) fp[4].ad(a[5]), fp[4][0] = a[3], fp[4][1] = a[4];
else fp[a[0]].ad(a[3]);
}
else fp[sm].ad(a[3]);
}
else
{
fp[a[0]].ad(a[3]), fp[a[0]].ad(a[4]);
sm = getNextLightest(1, 2, 3, a[5]);
if(sm == a[0])
{
if(getLightest(a[0], a[1], a[5]) == a[0]) fp[4].ad(a[5]);
else fp[a[0]].ad(a[5]);
}
else fp[sm].ad(a[5]);
}
}
else
{
fp[sm].push_back(a[4]);
int ss;
ss = getNextLightest(1, 2, 3, a[3]);
fp[ss].ad(a[3]);
swap(fp[ss][0], fp[ss].back());
ss = getNextLightest(1, 2, 3, a[5]);
if(ss == a[0]) ss = 4;
fp[ss].ad(a[5]);
}
int W[] = {1, 2, 3, 4, 5, 6 };
//vii W(6)
int i1 = 0;
for(int i : {0, 1, 2})
{
for(auto p : fp[a[i]]) W[i1++] = p;
W[i1++] = a[i];
}
for(auto p : fp[4]) W[i1++] = p;
for (int i = 0; i < 6; i++) fp[i].clear();
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |