답안 #798126

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
798126 2023-07-30T11:37:41 Z nnin 슈퍼트리 잇기 (IOI20_supertrees) C++14
21 / 100
165 ms 23996 KB
#include "supertrees.h"
#include <bits/stdc++.h>
using namespace std;

int dsu[1001];
int par(int x) {
    if(dsu[x]==x) return x;
    return dsu[x] = par(dsu[x]);
}

int construct(std::vector<std::vector<int>> p) {
	int n = p.size();
	vector<vector<int>> answer(n, vector<int>(n, 0));

	for(int i=0;i<n;i++) dsu[i] = i;

	for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) {
        if(p[i][j]) {
            int pari = par(i);
            int parj = par(j);
            if(pari!=parj) {
                dsu[pari] = parj;
                answer[pari][parj] = answer[parj][pari] = 1;
            }
        }
	}

	for(int i=0;i<n;i++) for(int j=0;j<n;j++) {
        if(!p[i][j]) {
            int pari = par(i);
            int parj = par(j);
            if(pari==parj) {
                return 0;
            }
        }
	}

	build(answer);
	return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 6 ms 1180 KB Output is correct
7 Correct 144 ms 22064 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 6 ms 1180 KB Output is correct
7 Correct 144 ms 22064 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 9 ms 1108 KB Output is correct
13 Correct 145 ms 22016 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 852 KB Output is correct
17 Correct 65 ms 14068 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 39 ms 6136 KB Output is correct
21 Correct 162 ms 23880 KB Output is correct
22 Correct 163 ms 23928 KB Output is correct
23 Correct 150 ms 23996 KB Output is correct
24 Correct 150 ms 23984 KB Output is correct
25 Correct 68 ms 14076 KB Output is correct
26 Correct 60 ms 14080 KB Output is correct
27 Correct 152 ms 23932 KB Output is correct
28 Correct 165 ms 23992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Too few ways to get from 0 to 1, should be 2 found 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 6 ms 1180 KB Output is correct
7 Correct 144 ms 22064 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 9 ms 1108 KB Output is correct
13 Correct 145 ms 22016 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 852 KB Output is correct
17 Correct 65 ms 14068 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 39 ms 6136 KB Output is correct
21 Correct 162 ms 23880 KB Output is correct
22 Correct 163 ms 23928 KB Output is correct
23 Correct 150 ms 23996 KB Output is correct
24 Correct 150 ms 23984 KB Output is correct
25 Correct 68 ms 14076 KB Output is correct
26 Correct 60 ms 14080 KB Output is correct
27 Correct 152 ms 23932 KB Output is correct
28 Correct 165 ms 23992 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 6 ms 1180 KB Output is correct
7 Correct 144 ms 22064 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 9 ms 1108 KB Output is correct
13 Correct 145 ms 22016 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 3 ms 852 KB Output is correct
17 Correct 65 ms 14068 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 39 ms 6136 KB Output is correct
21 Correct 162 ms 23880 KB Output is correct
22 Correct 163 ms 23928 KB Output is correct
23 Correct 150 ms 23996 KB Output is correct
24 Correct 150 ms 23984 KB Output is correct
25 Correct 68 ms 14076 KB Output is correct
26 Correct 60 ms 14080 KB Output is correct
27 Correct 152 ms 23932 KB Output is correct
28 Correct 165 ms 23992 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Incorrect 0 ms 212 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -