# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
751901 | Seb | Scales (IOI15_scales) | C++17 | 1 ms | 340 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;
void init(int T) {
return;
}
void orderCoins() {
int W[] = {1, 2, 3, 4, 5, 6};
int a,b,c=1,in,aux;
a = getHeaviest(W[0],W[1],W[2]);
b = getHeaviest(W[3],W[4],W[5]);
while (c==a || c==b) c++;
aux = getHeaviest(a,b,c);
for (int i=0;i<6;i++) if (aux==W[i]) in = i;
swap(W[in],W[5]);
a = getHeaviest(W[0],W[1],W[2]);
b = getHeaviest(W[3],W[4],a);
for (int i=0;i<5;i++) if (b==W[i]) in = i;
swap(W[in],W[4]);
a = getHeaviest(W[0],W[1],W[2]);
b = getMedian(a,W[5],W[3]);
for (int i=0;i<4;i++) if (b==W[i]) in = i;
swap(W[in],W[3]);
a = getHeaviest(W[0],W[1],W[2]);
for (int i=0;i<3;i++) if (a==W[i]) in = i;
swap(W[in],W[2]);
a = getMedian(W[0],W[1],W[2]);
for (int i=0;i<3;i++) if (a==W[i]) in = i;
swap(W[in],W[1]);
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |