# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
128386 | kingfran1907 | 저울 (IOI15_scales) | C++14 | 2 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 10;
int fir[maxn];
int sec[maxn];
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int w[] = {0, 0, 0, 0, 0, 0};
fir[0] = getLightest(1, 2, 3);
fir[1] = getMedian(1, 2, 3);
fir[2] = 1 + 2 + 3 - fir[0] - fir[1];
sec[0] = getLightest(4, 5, 6);
sec[1] = getMedian(4, 5, 6);
sec[2] = 4 + 5 + 6 - sec[0] - sec[1];
int ptr1 = 0, ptr2 = 0;
int ptr = 0;
//cout << "fir: "; for (int i = 0; i < 3; i++) //cout << fir[i] << " "; //cout << endl;
//cout << "sec: "; for (int i = 0; i < 3; i++) //cout << sec[i] << " "; //cout << endl;
while (ptr < 6) {
if (ptr1 == 3) {
for (int i = ptr2; i < 3; i++)
w[ptr++] = sec[i];
ptr2 = 3;
} else if (ptr2 == 3) {
for (int i = ptr1; i < 3; i++)
w[ptr++] = fir[i];
ptr1 = 3;
} else if (ptr == 5) {
if (ptr1 == 2) w[ptr] = fir[ptr1], ptr++, ptr1++;
else if (ptr2 == 2) w[ptr] = sec[ptr2], ptr++, ptr2++;
} else if (ptr1 == 2 && ptr2 == 2) {
w[ptr] = getMedian(fir[2], sec[2], w[0]);
w[ptr + 1] = fir[2] + sec[2] - w[ptr];
ptr += 2, ptr1++, ptr2++;
} else if (ptr1 < 2) {
//cout << "considering: " << fir[ptr1] << " " << fir[ptr1 + 1] << " " << sec[ptr2] << endl;
int x = getMedian(fir[ptr1], fir[ptr1 + 1], sec[ptr2]);
if (x == fir[ptr1 + 1]) {
w[ptr] = fir[ptr1];
w[ptr + 1] = fir[ptr1 + 1];
w[ptr + 2] = sec[ptr2];
ptr += 3, ptr1 += 2, ptr2++;
} else if (x == fir[ptr]) {
w[ptr] = sec[ptr2];
w[ptr + 1] = fir[ptr1];
w[ptr + 2] = fir[ptr1 + 1];
ptr += 3, ptr1 += 2, ptr2++;
} else {
//cout << "kurac" << endl;
w[ptr] = fir[ptr1];
w[ptr + 1] = sec[ptr2];
//w[ptr + 2] = fir[ptr + 1];
ptr += 2, ptr1++, ptr2++;
}
//cout << "res: " << w[ptr - 3] << " " << w[ptr - 2] << " " << w[ptr - 1] << endl;
} else if (ptr2 < 2) {
//cout << "considering: " << sec[ptr2] << " " << sec[ptr2 + 1] << " " << fir[ptr1] << endl;
int x = getMedian(sec[ptr2], sec[ptr2 + 1], fir[ptr1]);
if (x == sec[ptr2 + 1]) {
w[ptr] = sec[ptr2];
w[ptr + 1] = sec[ptr2 + 1];
w[ptr + 2] = fir[ptr1];
ptr += 3, ptr2 += 2, ptr1++;
} else if (x == sec[ptr2]) {
w[ptr] = fir[ptr1];
w[ptr + 1] = sec[ptr2];
w[ptr + 2] = sec[ptr2 + 1];
ptr += 3, ptr2 += 2, ptr1++;
} else {
//cout << "kurac" << endl;
w[ptr] = sec[ptr2];
w[ptr + 1] = fir[ptr1];
//w[ptr + 2] = sec[ptr2 + 1];
ptr += 2, ptr2++, ptr1++;
}
//cout << "res: " << w[ptr - 3] << " " << w[ptr - 2] << " " << w[ptr - 1] << endl;
}
//cout << "w: ";
//for (int i = 0; i < 6; i++) //cout << w[i] << " ";
//cout << endl;
}
answer(w);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |