제출 #303126

#제출 시각아이디문제언어결과실행 시간메모리
303126llaki슈퍼트리 잇기 (IOI20_supertrees)Java
11 / 100
385 ms56392 KiB
public class supertrees {
    int construct(int[][] p) {
        int n = p.length;
        if (areAllOnes(p)) {
            return constructForAllOnes(n);
        }
        int[][] answer = new int[n][n];

        grader.build(answer);
        return 1;
    }

    boolean areAllOnes(int[][] p) {
        for (int i = 0; i < p.length; i++) {
            for (int j = 0; j < p[i].length; j++) {
                if (p[i][j] != 1) return false;
            }
        }
        return true;
    }

    int constructForAllOnes(int n) {
        int[][] res = new int[n][n];
        for (int i = 0; i < n - 1; i++) {
            res[i][i + 1] = 1;
            res[i + 1][i] = 1;
        }
        grader.build(res);
        return 1;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...