| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 668548 | LittleCube | 저울 (IOI15_scales) | C++17 | 3 ms | 216 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "scales.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void init(int T)
{
}
/*
int getMedian(int A, int B, int C);
int getHeaviest(int A, int B, int C);
int getLightest(int A, int B, int C);
int getNextLightest(int A, int B, int C, int D);
*/
void ans(int a, int b, int c, int d, int e, int f)
{
int ret[6] = {a, b, c, d, e, f};
answer(ret);
}
void orderCoins()
{
int a, b, c, d, e, f;
b = getMedian(1, 2, 3);
a = (b == 1 ? 2 : 1);
c = (b == 3 ? 2 : 3);
d = 4;
e = 5;
f = 6;
int res;
res = getNextLightest(a, c, d, b);
if (res == a)
{
res = getMedian(c, d, a);
if (res == a)
tie(a, b, c, d) = make_tuple(c, b, a, d);
else if (res == c)
tie(a, b, c, d) = make_tuple(d, c, b, a);
else
tie(a, b, c, d) = make_tuple(c, d, b, a);
}
else if (res == c)
{
res = getMedian(a, b, d);
if (res == a)
tie(a, b, c, d) = make_tuple(d, a, b, c);
else if (res == b)
tie(a, b, c, d) = make_tuple(a, b, c, d);
else
tie(a, b, c, d) = make_tuple(a, d, b, c);
}
else
{
res = getHeaviest(a, b, c);
if (res == c)
tie(a, b, c, d) = make_tuple(a, b, d, c);
else
tie(a, b, c, d) = make_tuple(c, b, d, a);
}
vector<int> v = {a, b, c, d};
int pos = 0;
res = getMedian(b, c, e);
if (res == e)
pos = 2;
else if (res == b)
{
res = getMedian(a, b, e);
if (res == a)
pos = 0;
else
pos = 1;
}
else
{
res = getMedian(c, d, e);
if (res == e)
pos = 3;
else
pos = 4;
}
v.insert(v.begin() + pos, e);
tie(a, b, c, d, e) = make_tuple(v[0], v[1], v[2], v[3], v[4]);
res = getMedian(b, d, f);
if (res == f)
{
res = getMedian(b, c, f);
if (res == f)
pos = 2;
else
pos = 3;
}
else if (res == b)
{
res = getMedian(a, b, f);
if (res == a)
pos = 0;
else
pos = 1;
}
else
{
res = getMedian(d, e, f);
if (res == f)
pos = 4;
else
pos = 5;
}
v.insert(v.begin() + pos, f);
ans(v[0], v[1], v[2], v[3], v[4], v[5]);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
