# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1068475 | ArthuroWich | Scales (IOI15_scales) | C++17 | 1 ms | 600 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) {
}
void orderCoins() {
int W[6];
vector<int> a = {1, 2, 3, 4, 5, 6};
int j = 0;
while(a.size() != 3) {
int sh = getLightest(a[0], a[1], a[2]);
if (a.size() == 4) {
if (sh != a[0]) {
sh = getLightest(sh, a[0], a[3]);
} else {
sh = getLightest(sh, a[1], a[3]);
}
} else if (a.size() == 5) {
sh = getLightest(sh, a[3], a[4]);
} else if (a.size() == 6) {
sh = getLightest(sh, a[3], a[4]);
if (sh != a[0]) {
sh = getLightest(sh, a[0], a[5]);
} else {
sh = getLightest(sh, a[1], a[5]);
}
}
W[j] = sh;
j++;
a.erase(find(a.begin(), a.end(), sh));
}
W[j] = getLightest(a[0], a[1], a[2]);
j++;
W[j] = getMedian(a[0], a[1], a[2]);
j++;
a.erase(find(a.begin(), a.end(), W[j-1]));
a.erase(find(a.begin(), a.end(), W[j-2]));
W[j] = a[0];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |