# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
639832 | piOOE | 저울 (IOI15_scales) | C++17 | 1 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "scales.h"
using namespace std;
void init(int T) {
}
constexpr int n = 6;
void ord(int a[]) {
int x = getHeaviest(a[0], a[1], a[2]);
int y = getMedian(a[0], a[1], a[2]);
int z = a[0] + a[1] + a[2] - x - y;
a[0] = x, a[1] = y, a[2] = z;
}
int p[n], a[3], b[3], ans[3];
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
void orderCoins() {
int tmp[6];
iota(tmp, tmp + 6, 1);
shuffle(tmp, tmp + 6, rnd);
for (int i = 0; i < 3; ++i) {
a[i] = tmp[i];
b[i] = tmp[i + 3];
}
ord(a), ord(b);
for (int i = 0; i < 3; ++i) {
ans[i] = getNextLightest(a[0], a[1], a[2], b[i]);
}
if (ans[0] == ans[1] && ans[1] == ans[2] && ans[0] == a[2]) {
//either all bigger or all smaller
bool smaller = getLightest(a[0], a[1], b[1]) == b[1];
if (smaller) {
smaller = getLightest(a[0], a[1], b[0]) == b[0];
if (smaller) {
p[0] = a[0], p[1] = a[1], p[2] = a[2];
p[3] = b[0], p[4] = b[1], p[5] = b[2];
} else {
p[1] = a[0], p[2] = a[1], p[3] = a[2];
p[0] = b[0], p[4] = b[1], p[5] = b[2];
}
} else {
smaller = getLightest(a[0], a[1], b[2]) == b[2];
if (smaller) {
p[2] = a[0], p[3] = a[1], p[4] = a[2];
p[0] = b[0], p[1] = b[1], p[5] = b[2];
} else {
p[3] = a[0], p[4] = a[1], p[5] = a[2];
p[0] = b[0], p[1] = b[1], p[2] = b[2];
}
}
reverse(p, p + n);
answer(p);
} else {
int pntB = 0, pnt = 0;
for (int i = 0; i < 3; ++i) {
if (ans[i] == a[2]) {
p[pnt++] = b[i];
++pntB;
} else {
break;
}
}
for (int i = 0; i < 3; ++i) {
p[pnt++] = a[i];
while (pntB < 3 && ans[pntB] == a[i]) {
p[pnt++] = b[pntB++];
}
}
reverse(p, p + n);
answer(p);
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |