# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
423290 | Ozy | Scales (IOI15_scales) | C++17 | 1 ms | 296 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;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[6],a,b,c,d,MINa,MINb,k,kk;
MINa = getLightest(1,2,3);
if (MINa == 1) {a = 2;b = 3;}
else if (MINa == 2) {a = 1;b = 3;}
else {a = 1;b = 2;}
MINb = getLightest(4,5,6);
if (MINb == 4) {c = 5;d = 6;}
else if (MINb == 5) {c = 4;d = 6;}
else {c = 4;d = 5;}
W[0] = getLightest(MINa,MINb,a);
if(W[0] == MINb) {
swap(MINa,MINb);
swap(a,c);
swap(b,d);
}
W[1] = getLightest(a,b,MINb);
if(W[1] == MINb) {
//4 sobrantes
k = getLightest(a,b,c);
if (k == c) kk = a;
else kk = c;
W[2] = getLightest(k,kk,d);
if (W[2] == a) a = d;
else if (W[2] == b) b = d;
else if (W[2] == c) c = d;
W[3] = getLightest(a,b,c);
W[4] = getMedian(a,b,c);
if (a != W[3] && a != W[4]) W[5] = a;
else if (b != W[3] && b != W[4]) W[5] = b;
else W[5] = c;
}
else {
if (W[1] == a) a = b;
W[2] = getLightest(a,MINb,c);
if (W[2] == a) a = MINb;
W[3] = getLightest(a,c,d);
W[4] = getMedian(a,c,d);
if (a != W[3] && a != W[4]) W[5] = a;
else if (c != W[3] && c != W[4]) W[5] = c;
else W[5] = d;
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |