답안 #832257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832257 2023-08-21T07:59:32 Z Johann 슈퍼트리 잇기 (IOI20_supertrees) C++14
11 / 100
159 ms 22644 KB
#include "supertrees.h"
#include "bits/stdc++.h"
using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()

int construct(std::vector<std::vector<int>> p)
{
	int N = p.size();
	vi comp(N, -1);

	vvi ans(N, vi(N, 0));
	for (int v = 0; v < N; ++v)
	{
		if (comp[v] == -1)
		{
			vvi c(4);
			comp[v] = v;
			for (int u = 0; u < N; ++u)
			{
				if (p[v][u] == 0 || u == v)
					continue;
				if (comp[u] != -1)
					return 0;
				comp[u] = v;
				c[p[v][u]].push_back(u);
			}

			if (sz(c[2]) && sz(c[3]))
				return 0;

			for (int u : c[1])
			{
				ans[v][u] = ans[u][v] = 1;
				for (int w = 0; w < N; ++w)
					if (comp[v] != comp[u] && p[u][w] > 0)
						return 0;
				for (int w : c[1])
					if (p[u][w] != 1)
						return 0;
				for (int w : c[2])
					if (p[u][w] != 2)
						return 0;
				for (int w : c[3])
					if (p[u][w] != 3)
						return 0;
			}
		}
	}

	build(ans);
	return 1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1236 KB Output is correct
7 Correct 150 ms 22532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1236 KB Output is correct
7 Correct 150 ms 22532 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 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 7 ms 1200 KB Output is correct
13 Correct 158 ms 22644 KB Output is correct
14 Correct 1 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 66 ms 12548 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 296 KB Output is correct
20 Correct 38 ms 6196 KB Output is correct
21 Correct 156 ms 22528 KB Output is correct
22 Correct 159 ms 22472 KB Output is correct
23 Correct 155 ms 22476 KB Output is correct
24 Correct 153 ms 22476 KB Output is correct
25 Incorrect 153 ms 22532 KB Answer gives possible 1 while actual possible 0
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 296 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 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1236 KB Output is correct
7 Correct 150 ms 22532 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 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 7 ms 1200 KB Output is correct
13 Correct 158 ms 22644 KB Output is correct
14 Correct 1 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 66 ms 12548 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 296 KB Output is correct
20 Correct 38 ms 6196 KB Output is correct
21 Correct 156 ms 22528 KB Output is correct
22 Correct 159 ms 22472 KB Output is correct
23 Correct 155 ms 22476 KB Output is correct
24 Correct 153 ms 22476 KB Output is correct
25 Incorrect 153 ms 22532 KB Answer gives possible 1 while actual possible 0
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 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 1236 KB Output is correct
7 Correct 150 ms 22532 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 300 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 7 ms 1200 KB Output is correct
13 Correct 158 ms 22644 KB Output is correct
14 Correct 1 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 66 ms 12548 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 296 KB Output is correct
20 Correct 38 ms 6196 KB Output is correct
21 Correct 156 ms 22528 KB Output is correct
22 Correct 159 ms 22472 KB Output is correct
23 Correct 155 ms 22476 KB Output is correct
24 Correct 153 ms 22476 KB Output is correct
25 Incorrect 153 ms 22532 KB Answer gives possible 1 while actual possible 0
26 Halted 0 ms 0 KB -