답안 #625057

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
625057 2022-08-09T09:41:15 Z cfalas 슈퍼트리 잇기 (IOI20_supertrees) C++17
21 / 100
184 ms 24068 KB
#include<bits/stdc++.h>
#include "supertrees.h"
#include <vector>
using namespace std;

typedef vector<int> vi;
#define FORi(i,a,b) for(int i=((int)a);i<((int)b);i++)
#define FOR(i,n) FORi(i,0,n)

int par[10000];
int fnd(int a){
	if(par[a]==a) return a;
	par[a] = fnd(par[a]);
	return par[a];
}

void onion(int a, int b){
	par[fnd(a)] = fnd(b);
}

int construct(vector<vector<int>> p) {
	int n = p.size();
	FOR(i,n) par[i] = i;
	vector<std::vector<int>> adj(n, vi(n, 0));
	FOR(i,n){
		FOR(j,n){
			if(p[i][j] && fnd(i)!=fnd(j)){
				onion(i, j);
				adj[i][j] = 1;
				adj[j][i] = 1;
			}
			else if(!p[i][j] && fnd(i)==fnd(j)){
				return 0;
			}
		}
	}
	build(adj);
	return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 7 ms 1108 KB Output is correct
7 Correct 183 ms 22028 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 7 ms 1108 KB Output is correct
7 Correct 183 ms 22028 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 8 ms 1240 KB Output is correct
13 Correct 167 ms 23960 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 308 KB Output is correct
16 Correct 4 ms 852 KB Output is correct
17 Correct 100 ms 14080 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 43 ms 6348 KB Output is correct
21 Correct 172 ms 23944 KB Output is correct
22 Correct 166 ms 24016 KB Output is correct
23 Correct 184 ms 23992 KB Output is correct
24 Correct 168 ms 23980 KB Output is correct
25 Correct 87 ms 14076 KB Output is correct
26 Correct 71 ms 14080 KB Output is correct
27 Correct 184 ms 24068 KB Output is correct
28 Correct 173 ms 23936 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 1 ms 212 KB Output is correct
4 Incorrect 1 ms 340 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 1 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 1 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 7 ms 1108 KB Output is correct
7 Correct 183 ms 22028 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 8 ms 1240 KB Output is correct
13 Correct 167 ms 23960 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 308 KB Output is correct
16 Correct 4 ms 852 KB Output is correct
17 Correct 100 ms 14080 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 43 ms 6348 KB Output is correct
21 Correct 172 ms 23944 KB Output is correct
22 Correct 166 ms 24016 KB Output is correct
23 Correct 184 ms 23992 KB Output is correct
24 Correct 168 ms 23980 KB Output is correct
25 Correct 87 ms 14076 KB Output is correct
26 Correct 71 ms 14080 KB Output is correct
27 Correct 184 ms 24068 KB Output is correct
28 Correct 173 ms 23936 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Incorrect 1 ms 340 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 7 ms 1108 KB Output is correct
7 Correct 183 ms 22028 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 300 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 8 ms 1240 KB Output is correct
13 Correct 167 ms 23960 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 308 KB Output is correct
16 Correct 4 ms 852 KB Output is correct
17 Correct 100 ms 14080 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 43 ms 6348 KB Output is correct
21 Correct 172 ms 23944 KB Output is correct
22 Correct 166 ms 24016 KB Output is correct
23 Correct 184 ms 23992 KB Output is correct
24 Correct 168 ms 23980 KB Output is correct
25 Correct 87 ms 14076 KB Output is correct
26 Correct 71 ms 14080 KB Output is correct
27 Correct 184 ms 24068 KB Output is correct
28 Correct 173 ms 23936 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Incorrect 1 ms 340 KB Answer gives possible 1 while actual possible 0
33 Halted 0 ms 0 KB -