# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
313358 | KWang31 | Torrent (COI16_torrent) | Java | 2007 ms | 107772 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
import java.io.*; import java.util.*;
public class torrent {
/**
* COI 16/4
* DP on tree + Binary Search
*/
static ArrayList<Integer> arl[];
static int[] par;
static int[] dp;
public static void main(String[] args) throws IOException {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st=new StringTokenizer(br.readLine());
int N=Integer.parseInt(st.nextToken());
int A=Integer.parseInt(st.nextToken())-1;
int B=Integer.parseInt(st.nextToken())-1;
arl=new ArrayList[N];
for (int i = 0; i < N; i++) {
arl[i]=new ArrayList<>();
}
int x,y;
for (int i = 0; i < N-1; i++) {
st=new StringTokenizer(br.readLine());
x=Integer.parseInt(st.nextToken())-1;
y=Integer.parseInt(st.nextToken())-1;
arl[x].add(y); arl[y].add(x);
}
//Step 1: Find the path between A and B with parent pointer
par=new int[N]; dp=new int[N];
dp(-1,-1,A); par[A]=-1;
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |