# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
791801 | Josia | Scales (IOI15_scales) | C++17 | 1 ms | 300 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"
using namespace std;
#include <bits/stdc++.h>
void init(int T) {
/* ... */
}
void orderCoins() {
int a1 = getLightest(1, 2, 3);
int a2 = getMedian(1, 2, 3);
set<int> a = {1,2,3};
a.erase(a1);
a.erase(a2);
int a3 = *a.begin();
int b1 = getLightest(4,5,6);
int b2 = getMedian(4,5,6);
set<int> b = {4,5,6};
b.erase(b1);
b.erase(b2);
int b3 = *b.begin();
deque<int> A, B;
A = {a1, a2, a3};
B = {b1, b2, b3};
vector<int> res;
res.push_back(getLightest(A[0], A[1], B[0]));
if (res[0] == B[0]) B.pop_front();
else A.pop_front();
while (A.size() && B.size()) {
res.push_back(getMedian(res[0], A[0], B[0]));
if (res.back() == B[0]) B.pop_front();
else A.pop_front();
}
for (int i:A) res.push_back(i);
for (int i:B) res.push_back(i);
int W[] = {1,2,3,4,5,6};
for (int i = 0; i<6; i++) {
W[i] = res[i];
// cerr << res[i] << " ";
}
// cerr << "\n";
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |