# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
286493 | dolphingarlic | 저울 (IOI15_scales) | C++14 | 1 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
int med(int A, int B, int C, vector<int> p) {
A--; B--; C--;
if (p[B] < p[A] && p[A] < p[C]) return A + 1;
if (p[C] < p[A] && p[A] < p[B]) return A + 1;
if (p[A] < p[B] && p[B] < p[C]) return B + 1;
if (p[C] < p[B] && p[B] < p[A]) return B + 1;
return C + 1;
}
int hea(int A, int B, int C, vector<int> p) {
A--; B--; C--;
if (p[A] > p[B] && p[A] > p[C]) return A + 1;
if (p[B] > p[A] && p[B] > p[C]) return B + 1;
return C + 1;
}
int lig(int A, int B, int C, vector<int> p) {
A--; B--; C--;
if (p[A] < p[B] && p[A] < p[C]) return A + 1;
if (p[B] < p[A] && p[B] < p[C]) return B + 1;
return C + 1;
}
map<vector<int>, vector<int>> hsh;
void init(int T) {
vector<int> p = {1, 2, 3, 4, 5, 6};
do {
int A = med(1, 3, 5, p), B = med(2, 4, 6, p);
int C = hea(1, 2, 4, p), D = hea(3, 5, 6, p);
int E = lig(1, 4, 6, p), F = lig(2, 3, 5, p);
hsh[{A, B, C, D, E, F}] = p;
} while (next_permutation(p.begin(), p.end()));
}
void orderCoins() {
int A = getMedian(1, 3, 5), B = getMedian(2, 4, 6);
int C = getHeaviest(1, 2, 4), D = getHeaviest(3, 5, 6);
int E = getLightest(1, 4, 6), F = getLightest(2, 3, 5);
vector<int> res = hsh[{A, B, C, D, E, F}];
int W[6] = {res[0], res[1], res[2], res[3], res[4], res[5]};
answer(W);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |