# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
730274 | NeroZein | Scales (IOI15_scales) | C++17 | 1 ms | 304 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(3), b(3);
a[2] = getHeaviest(1, 2, 3);
a[0] = getLightest(1, 2, 3);
a[1] = 1 ^ 2 ^ 3 ^ a[0] ^ a[2];
b[2] = getHeaviest(4, 5, 6);
b[0] = getLightest(4, 5, 6);
b[1] = 4 ^ 5 ^ 6 ^ b[0] ^ b[2];
//4 queries
int x = getNextLightest(a[0], a[1], a[2], b[0]);
bool MnIsInB = true;
if (x == a[0]) {
int y = getLightest(a[0], a[1], b[0]);
if (y != b[0]) {
MnIsInB = false;
}
} else {
MnIsInB = false;
}
vector<int> ans;
if (MnIsInB) {///if returned b[0] then a[i] is bigger than b[2]
ans = b;
//cout << "MnIsInB" << '\n';
for (int i = 0; i <= 2; ++i) {
x = getNextLightest(b[0], b[1], b[2], a[i]);
if (x == b[0]) {
ans.insert(ans.begin() + ans.size(), a[i]);
} else {
for (int j = 0; j < (int) ans.size(); ++j) {
if (ans[j] == x) {
ans.insert(ans.begin() + j, a[i]);
break;
}
}
}
//for (int j = 0; j < (int) ans.size(); ++j) {
//cout << ans[j] << ' ';
//}
//cout << '\n';
}
} else {///if returned a[0] then b[i] is bigger than a[2]
ans = a;
for (int i = 0; i <= 2; ++i) {
x = getNextLightest(a[0], a[1], a[2], b[i]);
if (x == a[0]) {
ans.insert(ans.begin() + ans.size(), b[i]);
} else {
for (int j = 0; j < (int) ans.size(); ++j) {
if (ans[j] == x) {
ans.insert(ans.begin() + j, b[i]);
break;
}
}
}
}
}
for (int i = 0; i < 6; ++i) {
w[i] = ans[i];
}
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |