# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
589795 | MilosMilutinovic | Scales (IOI15_scales) | C++14 | 1 ms | 224 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.
/**
* author: wxhtzdy
* created: 05.07.2022 11:10:33
**/
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int tt) {
return;
}
void orderCoins() {
int ans[6];
int L0 = getLightest(1, 2, 3); // 3
int R0 = getLightest(4, 5, 6); // 4
int L1 = getMedian(1, 2, 3); // 2
int R1 = getMedian(4, 5, 6); // 6
int L2 = (1 ^ 2 ^ 3 ^ L0 ^ L1); // 1
int R2 = (4 ^ 5 ^ 6 ^ R0 ^ R1); // 5
int mn = getLightest(L0, R0, L1); // 3
ans[0] = mn; // 3
ans[1] = (mn ^ L0 ^ R0); // 4
ans[2] = L1; // 2
ans[3] = R1; // 6
ans[4] = L2; // 1
ans[5] = R2; // 5
for (int i = 0; i < 3; i++) {
int idx = getNextLightest(ans[i + 1], ans[i + 2], ans[i + 3], ans[i]); // 4
if (ans[i + 2] == idx) {
swap(ans[i + 1], ans[i + 2]);
} else if (ans[i + 3] == idx) {
swap(ans[i + 2], ans[i + 3]);
swap(ans[i + 1], ans[i + 2]);
}
}
if (getHeaviest(ans[3], ans[4], ans[5]) == ans[4]) {
swap(ans[4], ans[5]);
}
answer(ans);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |