답안 #957643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957643 2024-04-04T06:55:38 Z pragmatist 게임 (APIO22_game) C++17
12 / 100
4000 ms 17860 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

vector<int> g[30005];
bool is[1001][30005];

int n, k;

void init(int _n, int _k) {
	n = _n;
	k = _k;
	for(int i = 1; i < k; ++i) {
		g[i-1].push_back(i);
	}
	for(int i = 0; i < k; ++i) {	
		for(int j = i; j < k; ++j) {
			is[i][j]=1;
		}
	}
}

void dfs(int v, int root) {
	is[root][v] = 1;
	for(auto to : g[v]) {
		if(!is[root][to]) {
			dfs(to, root);
		}
	}
}

int add_teleporter(int u, int v) {
	if(v<=u && u<k) {
		return 1;
	}
	g[u].push_back(v);
	for(int i = 0; i < k; ++i) {
		if(is[i][u]) {
			dfs(u, i);
		}
	}
	for(int i = 0; i < k; ++i) {
		for(int j = 0; j < n; ++j) {
			if(is[i][j]) {
				for(auto to : g[j]) {
					if(to == i) {
						return 1;
					}
				}
			}
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 3160 KB Output is correct
3 Correct 7 ms 5208 KB Output is correct
4 Correct 2 ms 3160 KB Output is correct
5 Correct 7 ms 5208 KB Output is correct
6 Correct 9 ms 5208 KB Output is correct
7 Correct 7 ms 5208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 3160 KB Output is correct
3 Correct 7 ms 5208 KB Output is correct
4 Correct 2 ms 3160 KB Output is correct
5 Correct 7 ms 5208 KB Output is correct
6 Correct 9 ms 5208 KB Output is correct
7 Correct 7 ms 5208 KB Output is correct
8 Correct 1 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 3160 KB Output is correct
12 Correct 1 ms 3160 KB Output is correct
13 Correct 1 ms 3160 KB Output is correct
14 Correct 1 ms 3160 KB Output is correct
15 Correct 2 ms 3160 KB Output is correct
16 Correct 1 ms 3160 KB Output is correct
17 Correct 4 ms 3160 KB Output is correct
18 Correct 2 ms 3160 KB Output is correct
19 Correct 2 ms 3160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 3160 KB Output is correct
3 Correct 7 ms 5208 KB Output is correct
4 Correct 2 ms 3160 KB Output is correct
5 Correct 7 ms 5208 KB Output is correct
6 Correct 9 ms 5208 KB Output is correct
7 Correct 7 ms 5208 KB Output is correct
8 Correct 1 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 3160 KB Output is correct
12 Correct 1 ms 3160 KB Output is correct
13 Correct 1 ms 3160 KB Output is correct
14 Correct 1 ms 3160 KB Output is correct
15 Correct 2 ms 3160 KB Output is correct
16 Correct 1 ms 3160 KB Output is correct
17 Correct 4 ms 3160 KB Output is correct
18 Correct 2 ms 3160 KB Output is correct
19 Correct 2 ms 3160 KB Output is correct
20 Correct 5 ms 3160 KB Output is correct
21 Correct 8 ms 5208 KB Output is correct
22 Correct 42 ms 5464 KB Output is correct
23 Correct 5 ms 3416 KB Output is correct
24 Correct 402 ms 17496 KB Output is correct
25 Correct 1646 ms 9604 KB Output is correct
26 Correct 1106 ms 5532 KB Output is correct
27 Execution timed out 4096 ms 17860 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 3160 KB Output is correct
3 Correct 7 ms 5208 KB Output is correct
4 Correct 2 ms 3160 KB Output is correct
5 Correct 7 ms 5208 KB Output is correct
6 Correct 9 ms 5208 KB Output is correct
7 Correct 7 ms 5208 KB Output is correct
8 Correct 1 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 3160 KB Output is correct
12 Correct 1 ms 3160 KB Output is correct
13 Correct 1 ms 3160 KB Output is correct
14 Correct 1 ms 3160 KB Output is correct
15 Correct 2 ms 3160 KB Output is correct
16 Correct 1 ms 3160 KB Output is correct
17 Correct 4 ms 3160 KB Output is correct
18 Correct 2 ms 3160 KB Output is correct
19 Correct 2 ms 3160 KB Output is correct
20 Correct 5 ms 3160 KB Output is correct
21 Correct 8 ms 5208 KB Output is correct
22 Correct 42 ms 5464 KB Output is correct
23 Correct 5 ms 3416 KB Output is correct
24 Correct 402 ms 17496 KB Output is correct
25 Correct 1646 ms 9604 KB Output is correct
26 Correct 1106 ms 5532 KB Output is correct
27 Execution timed out 4096 ms 17860 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 3160 KB Output is correct
3 Correct 7 ms 5208 KB Output is correct
4 Correct 2 ms 3160 KB Output is correct
5 Correct 7 ms 5208 KB Output is correct
6 Correct 9 ms 5208 KB Output is correct
7 Correct 7 ms 5208 KB Output is correct
8 Correct 1 ms 1112 KB Output is correct
9 Correct 1 ms 1112 KB Output is correct
10 Correct 1 ms 1112 KB Output is correct
11 Correct 1 ms 3160 KB Output is correct
12 Correct 1 ms 3160 KB Output is correct
13 Correct 1 ms 3160 KB Output is correct
14 Correct 1 ms 3160 KB Output is correct
15 Correct 2 ms 3160 KB Output is correct
16 Correct 1 ms 3160 KB Output is correct
17 Correct 4 ms 3160 KB Output is correct
18 Correct 2 ms 3160 KB Output is correct
19 Correct 2 ms 3160 KB Output is correct
20 Correct 5 ms 3160 KB Output is correct
21 Correct 8 ms 5208 KB Output is correct
22 Correct 42 ms 5464 KB Output is correct
23 Correct 5 ms 3416 KB Output is correct
24 Correct 402 ms 17496 KB Output is correct
25 Correct 1646 ms 9604 KB Output is correct
26 Correct 1106 ms 5532 KB Output is correct
27 Execution timed out 4096 ms 17860 KB Time limit exceeded
28 Halted 0 ms 0 KB -