# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
138800 | Talant | Scales (IOI15_scales) | C++17 | 3 ms | 400 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 "grader.cpp"
#include <bits/stdc++.h>
#define sc second
#define fr first
#define mk make_pair
#define pb push_back
using namespace std;
const int N = (1e6 + 5);
const int inf = (1e9 + 7);
int t;
int a[7];
void init(int T) {
t = T;
}
void orderCoins() {
a[2] = getHeaviest(1,2,3);
a[1] = getMedian(1,2,3);
a[0] = 6 - (a[2] + a[1]);
a[5] = getHeaviest(4,5,6);
a[4] = getMedian(4,5,6);
a[3] = 15 - a[5] - a[4];
///1
int o = getNextLightest(a[1],a[2],a[0],a[3]);
int cur = a[3];
if (o == a[0]) {
int oo = getLightest(a[0],a[1],cur);
if (oo == cur) {
for (int i = 2; i >= 0; i --)
a[i + 1] = a[i];
a[0] = cur;
}
else {
answer(a);
}
}
else {
for (int i = 2; i >= 1; i --) {
a[i + 1] = a[i];
if (a[i] == o) {
a[i] = cur;
break;
}
}
}
///2
o = getNextLightest(a[1],a[2],a[3],a[4]);
cur = a[4];
if (o == a[1]) {
int oo = getLightest(a[1],a[2],cur);
if (oo == cur) {
for (int i = 3; i >= 1; i --)
a[i + 1] = a[i];
a[1] = cur;
}
else {
answer(a);
}
}
else {
for (int i = 3; i >= 2; i --) {
a[i + 1] = a[i];
if (a[i] == o) {
a[i] = cur;
break;
}
}
}
///3
o = getNextLightest(a[4],a[2],a[3],a[5]);
cur = a[5];
if (o == a[2]) {
int oo = getLightest(a[2],a[3],cur);
if (oo == cur) {
for (int i = 4; i >= 2; i --)
a[i + 1] = a[i];
a[2] = cur;
}
else {
answer(a);
}
}
else {
for (int i = 4; i >= 3; i --) {
a[i + 1] = a[i];
if (a[i] == o) {
a[i] = cur;
break;
}
}
}
answer(a);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |