답안 #702243

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
702243 2023-02-23T11:18:57 Z ld_minh4354 게임 (APIO22_game) C++17
30 / 100
4000 ms 9852 KB
#include<bits/stdc++.h>
using namespace std;

vector<int> adj[300005];
int st[300005],N,ans,K;

void dfs(int u)
{
//	cout<<u<<" ";
	if (st[u]!=0)
	{
		if (st[u]==1 and u<K) ans=1;
		return;
	}
	
	st[u]=1;
	for (auto v:adj[u]) dfs(v);
	st[u]=2;
}

void init(int n, int k)
{
	N=n;K=k;
	for (int i=1;i<k;i++) adj[i-1].push_back(i);
}

int add_teleporter(int u, int v)
{
	adj[u].push_back(v);
	sort(adj[u].begin(),adj[u].end());
	
	ans=0;
	for (int i=0;i<N;i++) st[i]=0;
	dfs(0);
	
//	cout<<"\n";
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 3 ms 7248 KB Output is correct
10 Correct 5 ms 7248 KB Output is correct
11 Correct 5 ms 7248 KB Output is correct
12 Correct 5 ms 7332 KB Output is correct
13 Correct 5 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7316 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7248 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 3 ms 7248 KB Output is correct
10 Correct 5 ms 7248 KB Output is correct
11 Correct 5 ms 7248 KB Output is correct
12 Correct 5 ms 7332 KB Output is correct
13 Correct 5 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7316 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7248 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 6 ms 7376 KB Output is correct
23 Correct 5 ms 7360 KB Output is correct
24 Correct 12 ms 7412 KB Output is correct
25 Correct 44 ms 7372 KB Output is correct
26 Correct 72 ms 7372 KB Output is correct
27 Correct 74 ms 7400 KB Output is correct
28 Correct 22 ms 7376 KB Output is correct
29 Correct 56 ms 7396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 3 ms 7248 KB Output is correct
10 Correct 5 ms 7248 KB Output is correct
11 Correct 5 ms 7248 KB Output is correct
12 Correct 5 ms 7332 KB Output is correct
13 Correct 5 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7316 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7248 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 6 ms 7376 KB Output is correct
23 Correct 5 ms 7360 KB Output is correct
24 Correct 12 ms 7412 KB Output is correct
25 Correct 44 ms 7372 KB Output is correct
26 Correct 72 ms 7372 KB Output is correct
27 Correct 74 ms 7400 KB Output is correct
28 Correct 22 ms 7376 KB Output is correct
29 Correct 56 ms 7396 KB Output is correct
30 Correct 220 ms 8012 KB Output is correct
31 Correct 106 ms 7700 KB Output is correct
32 Correct 138 ms 9060 KB Output is correct
33 Correct 111 ms 8392 KB Output is correct
34 Correct 1310 ms 9852 KB Output is correct
35 Execution timed out 4083 ms 8428 KB Time limit exceeded
36 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 7248 KB Output is correct
2 Correct 4 ms 7248 KB Output is correct
3 Correct 5 ms 7248 KB Output is correct
4 Correct 4 ms 7248 KB Output is correct
5 Correct 4 ms 7248 KB Output is correct
6 Correct 5 ms 7248 KB Output is correct
7 Correct 4 ms 7248 KB Output is correct
8 Correct 4 ms 7248 KB Output is correct
9 Correct 3 ms 7248 KB Output is correct
10 Correct 5 ms 7248 KB Output is correct
11 Correct 5 ms 7248 KB Output is correct
12 Correct 5 ms 7332 KB Output is correct
13 Correct 5 ms 7248 KB Output is correct
14 Correct 4 ms 7248 KB Output is correct
15 Correct 4 ms 7316 KB Output is correct
16 Correct 5 ms 7248 KB Output is correct
17 Correct 5 ms 7248 KB Output is correct
18 Correct 4 ms 7248 KB Output is correct
19 Correct 4 ms 7248 KB Output is correct
20 Correct 6 ms 7376 KB Output is correct
21 Correct 4 ms 7248 KB Output is correct
22 Correct 6 ms 7376 KB Output is correct
23 Correct 5 ms 7360 KB Output is correct
24 Correct 12 ms 7412 KB Output is correct
25 Correct 44 ms 7372 KB Output is correct
26 Correct 72 ms 7372 KB Output is correct
27 Correct 74 ms 7400 KB Output is correct
28 Correct 22 ms 7376 KB Output is correct
29 Correct 56 ms 7396 KB Output is correct
30 Correct 220 ms 8012 KB Output is correct
31 Correct 106 ms 7700 KB Output is correct
32 Correct 138 ms 9060 KB Output is correct
33 Correct 111 ms 8392 KB Output is correct
34 Correct 1310 ms 9852 KB Output is correct
35 Execution timed out 4083 ms 8428 KB Time limit exceeded
36 Halted 0 ms 0 KB -