답안 #622565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
622565 2022-08-04T11:35:29 Z gromperen 게임 (APIO22_game) C++17
30 / 100
4000 ms 2956 KB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> adj;
vector<int> vis;
int n;
int k;

bool ans = 0;
int from;

void init(int nn, int kk) {
	n = nn;
	k = kk;
	adj.resize(n);
	for (int i = 0; i < k-1; ++i) {
		adj[i].push_back(i+1);
	}
}

void dfs(int u) {
	if (ans) return;
	if (u < from) {
		ans = 1;
		return;
	}
	if (vis[u]) {
		if (u == from) ans = 1;
		return;
	}
	vis[u] = 1;
	for (int v : adj[u]) {
		dfs(v);
	}
	return;
}

int add_teleporter(int u, int v) {
	vis.assign(n, 0);
	adj[u].push_back(v);
	for (from = k-1; from >= 0; --from) 
		dfs(from);

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 2 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 6 ms 352 KB Output is correct
25 Correct 36 ms 352 KB Output is correct
26 Correct 73 ms 356 KB Output is correct
27 Correct 63 ms 336 KB Output is correct
28 Correct 16 ms 336 KB Output is correct
29 Correct 38 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 2 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 6 ms 352 KB Output is correct
25 Correct 36 ms 352 KB Output is correct
26 Correct 73 ms 356 KB Output is correct
27 Correct 63 ms 336 KB Output is correct
28 Correct 16 ms 336 KB Output is correct
29 Correct 38 ms 344 KB Output is correct
30 Correct 477 ms 1664 KB Output is correct
31 Correct 135 ms 1288 KB Output is correct
32 Correct 345 ms 2540 KB Output is correct
33 Correct 338 ms 2028 KB Output is correct
34 Correct 1350 ms 2956 KB Output is correct
35 Execution timed out 4094 ms 2132 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 256 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 0 ms 208 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 2 ms 336 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 6 ms 352 KB Output is correct
25 Correct 36 ms 352 KB Output is correct
26 Correct 73 ms 356 KB Output is correct
27 Correct 63 ms 336 KB Output is correct
28 Correct 16 ms 336 KB Output is correct
29 Correct 38 ms 344 KB Output is correct
30 Correct 477 ms 1664 KB Output is correct
31 Correct 135 ms 1288 KB Output is correct
32 Correct 345 ms 2540 KB Output is correct
33 Correct 338 ms 2028 KB Output is correct
34 Correct 1350 ms 2956 KB Output is correct
35 Execution timed out 4094 ms 2132 KB Time limit exceeded
36 Halted 0 ms 0 KB -