답안 #805529

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
805529 2023-08-03T17:34:38 Z Hydrolyzed 슈퍼트리 잇기 (IOI20_supertrees) C++14
21 / 100
156 ms 23948 KB
#include "supertrees.h"
#include <vector>
#include <bitset>

using namespace std;

const int MxN = 1010;

bitset<MxN> done, in_tree;
vector<int> adj;

int construct(std::vector<std::vector<int>> p) {
	int n = (int) p.size();
	vector<vector<int>> building(n, vector<int> (n, 0));
	for(int i=0; i<=n-1; ++i) {
		if(done[i]) {
			continue;
		}
		adj.clear();
		for(int j=0; j<=n-1; ++j) {
			if(p[i][j] == 0) {
				continue;
			}
			adj.emplace_back(j);
			in_tree[j] = true;
		}
		for(auto from: adj) {
			for(int to=0; to<=n-1; ++to) {
				if((p[from][to] == 1 && !in_tree[to]) 
				|| (p[from][to] == 0 && in_tree[to])) {
					return 0;
				}
			}
		}
		for(auto x: adj) {
			in_tree[x] = false;
			done[x] = true;
		}
		for(int j=1; j<=(int)adj.size()-1; ++j) {
			building[adj[j-1]][adj[j]] = building[adj[j]][adj[j-1]] = 1;
		}
	}
	build(building);
	return 1;
}
# 결과 실행 시간 메모리 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 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 288 KB Output is correct
6 Correct 6 ms 1236 KB Output is correct
7 Correct 139 ms 23912 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 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 288 KB Output is correct
6 Correct 6 ms 1236 KB Output is correct
7 Correct 139 ms 23912 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 288 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 284 KB Output is correct
12 Correct 8 ms 1168 KB Output is correct
13 Correct 150 ms 23908 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 288 KB Output is correct
16 Correct 3 ms 816 KB Output is correct
17 Correct 85 ms 13976 KB Output is correct
18 Correct 0 ms 288 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 50 ms 6208 KB Output is correct
21 Correct 139 ms 23912 KB Output is correct
22 Correct 146 ms 23936 KB Output is correct
23 Correct 141 ms 23912 KB Output is correct
24 Correct 156 ms 23904 KB Output is correct
25 Correct 62 ms 14040 KB Output is correct
26 Correct 62 ms 14056 KB Output is correct
27 Correct 141 ms 23908 KB Output is correct
28 Correct 138 ms 23948 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 1 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 288 KB Output is correct
6 Correct 6 ms 1236 KB Output is correct
7 Correct 139 ms 23912 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 288 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 284 KB Output is correct
12 Correct 8 ms 1168 KB Output is correct
13 Correct 150 ms 23908 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 288 KB Output is correct
16 Correct 3 ms 816 KB Output is correct
17 Correct 85 ms 13976 KB Output is correct
18 Correct 0 ms 288 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 50 ms 6208 KB Output is correct
21 Correct 139 ms 23912 KB Output is correct
22 Correct 146 ms 23936 KB Output is correct
23 Correct 141 ms 23912 KB Output is correct
24 Correct 156 ms 23904 KB Output is correct
25 Correct 62 ms 14040 KB Output is correct
26 Correct 62 ms 14056 KB Output is correct
27 Correct 141 ms 23908 KB Output is correct
28 Correct 138 ms 23948 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 288 KB Output is correct
6 Correct 6 ms 1236 KB Output is correct
7 Correct 139 ms 23912 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 288 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 284 KB Output is correct
12 Correct 8 ms 1168 KB Output is correct
13 Correct 150 ms 23908 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 288 KB Output is correct
16 Correct 3 ms 816 KB Output is correct
17 Correct 85 ms 13976 KB Output is correct
18 Correct 0 ms 288 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 50 ms 6208 KB Output is correct
21 Correct 139 ms 23912 KB Output is correct
22 Correct 146 ms 23936 KB Output is correct
23 Correct 141 ms 23912 KB Output is correct
24 Correct 156 ms 23904 KB Output is correct
25 Correct 62 ms 14040 KB Output is correct
26 Correct 62 ms 14056 KB Output is correct
27 Correct 141 ms 23908 KB Output is correct
28 Correct 138 ms 23948 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 -