Submission #1034772

# Submission time Handle Problem Language Result Execution time Memory
1034772 2024-07-25T17:46:59 Z amine_aroua Game (APIO22_game) C++17
0 / 100
1 ms 344 KB
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int n , k;
vector<vector<bool>> vis;
vector<vector<int>> adj;
bool acc = 0;
void dfs(int x , int i)
{
	if(vis[i][x])
	{
		return ;
	}
  	if(x < k && x != i)
		acc = 1;
	vis[i][x] = 1;
	for(auto u : adj[x])
	{
		dfs(u , i);
	}
}
void init(int N, int K) {
	n = N , k = K;
	adj.assign(n , {});
	vis.assign(k , vector<bool>(n));
	for(int i = 0 ;i < k ; i++)
	{
		vis[i][i] = 1;
	}
}

int add_teleporter(int u, int v) {
 	if(u < k && u == v)
    	return 1;
	adj[u].push_back(v);
	for(int i = 0 ; i < k ; i++)
	{
		if(vis[i][u])
		{
			dfs(v , i);
		}
	}
	return acc;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer[1]
3 Halted 0 ms 0 KB -