답안 #832254

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832254 2023-08-21T07:54:37 Z Johann 슈퍼트리 잇기 (IOI20_supertrees) C++14
11 / 100
162 ms 24012 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 : 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 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 1 ms 212 KB Output is correct
6 Correct 7 ms 1176 KB Output is correct
7 Correct 148 ms 23988 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 1 ms 212 KB Output is correct
6 Correct 7 ms 1176 KB Output is correct
7 Correct 148 ms 23988 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 6 ms 1196 KB Output is correct
13 Correct 162 ms 23464 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 824 KB Output is correct
17 Correct 65 ms 14080 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 37 ms 6172 KB Output is correct
21 Correct 146 ms 23924 KB Output is correct
22 Correct 155 ms 24012 KB Output is correct
23 Correct 151 ms 23952 KB Output is correct
24 Correct 149 ms 23932 KB Output is correct
25 Incorrect 156 ms 23932 KB Answer gives possible 1 while actual possible 0
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 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 1 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 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 1 ms 212 KB Output is correct
6 Correct 7 ms 1176 KB Output is correct
7 Correct 148 ms 23988 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 6 ms 1196 KB Output is correct
13 Correct 162 ms 23464 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 824 KB Output is correct
17 Correct 65 ms 14080 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 37 ms 6172 KB Output is correct
21 Correct 146 ms 23924 KB Output is correct
22 Correct 155 ms 24012 KB Output is correct
23 Correct 151 ms 23952 KB Output is correct
24 Correct 149 ms 23932 KB Output is correct
25 Incorrect 156 ms 23932 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 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 1 ms 212 KB Output is correct
6 Correct 7 ms 1176 KB Output is correct
7 Correct 148 ms 23988 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 6 ms 1196 KB Output is correct
13 Correct 162 ms 23464 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 824 KB Output is correct
17 Correct 65 ms 14080 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 37 ms 6172 KB Output is correct
21 Correct 146 ms 23924 KB Output is correct
22 Correct 155 ms 24012 KB Output is correct
23 Correct 151 ms 23952 KB Output is correct
24 Correct 149 ms 23932 KB Output is correct
25 Incorrect 156 ms 23932 KB Answer gives possible 1 while actual possible 0
26 Halted 0 ms 0 KB -