# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
763138 | vjudge1 | Treasure Hunt (CEOI11_tre) | C++17 | 4062 ms | 167020 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
int sz;
#include "treinc.h"
int p[1000100][20], d[1000100];
void init(){
sz = d[1] = 1;
}
void AN(int to) {
p[++sz][0] = to;
d[sz] = d[to]+1;
for(int i = 1; i < 20; i++)
p[sz][i] = p[p[sz][i-1]][i-1];
}
void path(int a, int s)
{
for(int i = 0; i < s; i++) {
AN(a);
a = sz;
}
}
int lca(int a, int b) {
if(d[a]>d[b]) a+=b,b=a-b,a-=b;
for(int i = 20; i--;)
if(d[p[b][i]] >= d[a])
b = p[b][i];
if(a==b) return a;
for(int i = 20; i--;)
if(p[b][i]!=p[a][i])
a = p[a][i], b = p[b][i];
return p[a][0];
}
int jump(int x, int y) {
for(int i = 20; i--;)
if((1<<i)<=y)
x = p[x][i], y-=(1<<i);
return x;
}
int dig(int a, int b)
{
int x = lca(a, b);
int a_b = d[a]+d[b]-2*d[x], a_spot = a_b>>1, spot_b = a_b+1>>1;
if(d[a]-d[x]>=a_spot)
return jump(a,a_spot);
return jump(b,spot_b);
}
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |