제출 #335800

#제출 시각아이디문제언어결과실행 시간메모리
335800Agnimandur슈퍼트리 잇기 (IOI20_supertrees)Java
컴파일 에러
0 ms0 KiB
//public class supertrees public class supertrees { public int construct(int[][] p) { int N = p.length; for (int[] i: p) { for (int j: i) { if (j==3) return 0; } } for (int i = 0; i < N; i++) { if (p[i][i] != 1) return 0; } int[][] ans = new int[N][N]; boolean[] vis = new boolean[N]; boolean[] vis2 = new boolean[N]; ArrayDeque<Integer> bfs = new ArrayDeque<Integer>(); for (int r = 0; r < N; r++) { if (vis[r])continue; ArrayList<Integer> comp = new ArrayList<Integer>(); bfs.add(r); vis[r] = true; while (!bfs.isEmpty()) { int i = bfs.pollFirst(); comp.add(i); for (int j = 0; j < N; j++) { if (!vis[j] && p[i][j] > 0) { vis[j] = true; bfs.add(j); } } } for (int i = 0; i < comp.size(); i++) { for (int j = i+1; j < comp.size(); j++) { if (p[comp.get(i)][comp.get(j)]==0)return 0; } } ArrayList<Integer> cyc = new ArrayList<Integer>(); for (int c: comp) { if (vis2[c])continue; cyc.add(c); vis2[c] = true; bfs.add(c); ArrayList<Integer> sub = new ArrayList<Integer>(); while (!bfs.isEmpty()) { int i = bfs.pollFirst(); sub.add(i); for (int j: comp) { if (!vis2[j] && p[i][j]==1) { vis2[j] = true; bfs.add(j); } } } for (int ind = 1; ind < sub.size(); ind++) { int i = sub.get(ind-1); int j = sub.get(ind); if (i==j)continue; ans[i][j] = 1; ans[j][i] = 1; } for (int i = 0; i < sub.size(); i++) { for (int j = i+1; j < sub.size(); j++) { if (p[sub.get(i)][sub.get(j)]==2) return 0; } } } for (int ind = 0; ind < cyc.size(); ind++) { int i = cyc.get(ind); int j = cyc.get((ind+1)%cyc.size()); if (i==j)continue; ans[i][j] = 1; ans[j][i] = 1; } if (cyc.size()==2)return 0; for (int i = 0; i < cyc.size(); i++) { for (int j = i+1; j < cyc.size(); j++) { if (p[cyc.get(i)][cyc.get(j)]==1) return 0; } } } grader.build(ans); return 1; } }

컴파일 시 표준 에러 (stderr) 메시지

supertrees.java:17: error: cannot find symbol
    ArrayDeque<Integer> bfs = new ArrayDeque<Integer>();
    ^
  symbol:   class ArrayDeque
  location: class supertrees
supertrees.java:17: error: cannot find symbol
    ArrayDeque<Integer> bfs = new ArrayDeque<Integer>();
                                  ^
  symbol:   class ArrayDeque
  location: class supertrees
supertrees.java:20: error: cannot find symbol
      ArrayList<Integer> comp = new ArrayList<Integer>();
      ^
  symbol:   class ArrayList
  location: class supertrees
supertrees.java:20: error: cannot find symbol
      ArrayList<Integer> comp = new ArrayList<Integer>();
                                    ^
  symbol:   class ArrayList
  location: class supertrees
supertrees.java:39: error: cannot find symbol
      ArrayList<Integer> cyc = new ArrayList<Integer>();
      ^
  symbol:   class ArrayList
  location: class supertrees
supertrees.java:39: error: cannot find symbol
      ArrayList<Integer> cyc = new ArrayList<Integer>();
                                   ^
  symbol:   class ArrayList
  location: class supertrees
supertrees.java:45: error: cannot find symbol
        ArrayList<Integer> sub = new ArrayList<Integer>();
        ^
  symbol:   class ArrayList
  location: class supertrees
supertrees.java:45: error: cannot find symbol
        ArrayList<Integer> sub = new ArrayList<Integer>();
                                     ^
  symbol:   class ArrayList
  location: class supertrees
8 errors