| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 230945 | AlexLuchianov | Xylophone (JOI18_xylophone) | C++14 | 115 ms | 632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "xylophone.h"
#include <iostream>
int const nmax = 5000;
static int A[5000];
int diff[1 + nmax];
int change[1 + nmax];
int v[1 + nmax];
void solve(int n) {
for(int i = 1;i < n; i++)
diff[i] = query(i, i + 1);
change[1] = 1;
for(int i = 2; i < n; i++){
if(diff[i - 1] + diff[i] == query(i - 1, i + 1))
change[i] = change[i - 1];
else
change[i] = !change[i - 1];
}
v[1] = 0;
for(int i = 2;i <= n; i++)
if(change[i - 1] == 1)
v[i] = v[i - 1] + diff[i - 1];
else
v[i] = v[i - 1] - diff[i - 1];
int smin = 0;
for(int i = 1; i <= n; i++)
smin = std::min(smin, v[i]);
for(int i = 1;i <= n; i++)
v[i] = v[i] - smin + 1;
int pos1, posn;
for(int i = 1;i <= n; i++)
if(v[i] == 1)
pos1 = i;
else if(v[i] == n)
posn = i;
if(posn < pos1)
for(int i = 1; i <= n; i++)
v[i] = n - v[i] + 1;
for(int i = 1;i <= n; i++)
answer(i, v[i]);
}
/*
5
2 1 5 3 4
*/
컴파일 시 표준 에러 (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... | ||||
