# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
286309 | dolphingarlic | 저울 (IOI15_scales) | C++14 | 1 ms | 256 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() {
deque<int> K;
K.push_back(getLightest(1, 2, 3));
K.push_back(getMedian(1, 2, 3));
K.push_back(6 - K[0] - K[1]);
// cout << "DEBUG\n";
// for (int i : K) cout << i << ' ';
// cout << '\n';
int four_pos = getNextLightest(K[0], K[1], K[2], 4);
if (four_pos == K[0]) {
if (getLightest(K[0], K[1], 4) == 4) K.push_front(4);
else K.push_back(4);
} else K.insert(find(K.begin(), K.end(), four_pos), 4);
// for (int i : K) cout << i << ' ';
// cout << '\n';
int five_pos = getNextLightest(K[1], K[2], K[3], 5);
if (five_pos == K[1]) {
int med = getMedian(K[0], K[1], 5);
if (med == K[0]) K.push_front(5);
else if (med == K[1]) K.push_back(5);
else K.insert(K.begin() + 1, 5);
} else K.insert(find(K.begin(), K.end(), five_pos), 5);
// for (int i : K) cout << i << ' ';
// cout << '\n';
int six_pos = getNextLightest(K[2], K[3], K[4], 6);
if (six_pos == K[2]) {
int med = getMedian(K[1], K[2], 6);
if (med == K[1]) {
if (getLightest(K[0], K[1], 6) == 6) K.push_front(6);
else K.insert(K.begin() + 1, 6);
} else if (med == K[2]) K.push_back(6);
else K.insert(K.begin() + 2, 6);
} else K.insert(find(K.begin(), K.end(), six_pos), 6);
// for (int i : K) cout << i << ' ';
// cout << '\n';
// cout << "END DEBUG\n";
int W[6] = {K[0], K[1], K[2], K[3], K[4], K[5]};
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |