Submission #1034772

#TimeUsernameProblemLanguageResultExecution timeMemory
1034772amine_arouaGame (APIO22_game)C++17
0 / 100
1 ms344 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...