Submission #577352

#TimeUsernameProblemLanguageResultExecution timeMemory
577352handlenameGame (APIO22_game)C++17
30 / 100
89 ms14928 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair const int MOD=1e9+7; int n,k; vector<int> adj[300001]; bool work; bool vis[1001]; void init(int N,int K){ n=N; k=K; work=false; for (int i=0;i<k-1;i++){ adj[i].pb(i+1); } } void dfs(int x,int ori){ if (x==ori) work=true; if (work) return; if (vis[x]) return; vis[x]=true; for (auto i:adj[x]){ dfs(i,ori); } } int add_teleporter(int u,int v){ adj[u].pb(v); memset(vis,false,sizeof(vis)); for (int i=k-1;i>=0;i--){ for (auto j:adj[i]){ dfs(j,i); if (work) return 1; } } return 0; }
#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...