# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619842 | yanndev | 저울 (IOI15_scales) | C++17 | 1 ms | 212 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;
int mx = -1;
void init(int T) {
/* ... */
}
bool comp1(int a, int b) {
int c = -1;
for (int i = 1; i <= 6; i++)
if (i != a && i != b)
c = i;
int small = getLightest(a, b, c);
int big = getHeaviest(a, b, c);
if (b == big || a == small)
return true;
if (b == small || a == big)
return false;
return false;
}
bool comp2(int a, int b) {
if (b == mx)
return true;
if (a == mx)
return false;
int small = getLightest(a, b, mx);
return small == a;
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
vector<int> cur {};
for (int i = 1; i <= 6; i++) {
if ((int)cur.size() < 3) {
cur.push_back(i);
}
if ((int)cur.size() == 3) {
mx = getHeaviest(cur[0], cur[1], cur[2]);
cur = {mx};
}
}
if ((int)cur.size() > 1) {
for (int i = 1; (int)cur.size() < 3 && i <= 6; i++) {
if (find(cur.begin(), cur.end(), i) == cur.end()) {
cur.push_back(i);
}
}
mx = getHeaviest(cur[0], cur[1], cur[2]);
}
//cout << "mx is " << mx << '\n';
sort(W, W + 6, comp2);
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |