# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
57916 | paulica | Xylophone (JOI18_xylophone) | C++14 | 119 ms | 840 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "xylophone.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int n) {
int a[5010], d[5010];
for (int i = 0; i < n - 1; i++)
d[i] = query(i + 1, i + 2);
int sign = 1;
a[0] = 0;
a[1] = d[0];
for (int i = 1; i < n - 1; i++) {
if (query(i, i + 2) != (d[i - 1] + d[i]))
sign = -sign;
a[i + 1] = a[i] + sign * d[i];
}
int posMin = 0, posMax = 0;
for (int i = 1; i < n; i++) {
if (a[i] < a[posMin]) posMin = i;
if (a[i] > a[posMax]) posMax = i;
}
if (posMin > posMax) {
for (int i = 1; i < n; i++) a[i] = -a[i];
swap(posMin, posMax);
}
for (int i = 0; i < n; i++)
answer(i + 1, a[i] - a[posMin] + 1);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |