| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 720559 | hoainiem | Xylophone (JOI18_xylophone) | C++14 | 1 ms | 436 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "xylophone.h"
#include <bits/stdc++.h>
using namespace std;
int n, root, a[5008], dis[5008][5008];
void solve(int N) {
n = N;
for (int i = 1; i < n; i++)
a[i] = query(i, i + 1);
for (int i = 1, j = 1; i + 2 <= n; i++){
int tmp = query(i, i + 2);
if (tmp != a[i] + a[i + 1])
j *= -1;
a[i + 1] *= j;
}
for (int i = 1; i <= n; i++){
int cnt = 0;
for (int j = i + 1; j <= n; j++){
dis[i][j] = dis[i][j - 1] + a[j - 1];
if (dis[i][j] > 0)
cnt++;
}
for (int j = i - 1; j > 0; j--){
dis[i][j] = -dis[j][i];
}
if (!cnt || cnt + 1 == n){
root = i;
break;
}
}
for (int i = 1; i <= n; i++)
answer(i, abs(dis[root][i]) + 1);
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
