Submission #725291

#TimeUsernameProblemLanguageResultExecution timeMemory
725291Nahian9696Game (APIO22_game)C++17
0 / 100
0 ms208 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; // #define int long long #define f0(i, n) for(int i = 0; i < (n); i++) #define f1(i, n) for(int i = 1; i <= (n); i++) #define ff first #define ss second #define pb push_back int n, k; vector<vector<int>> grph; void init(int a, int b) { n = a; k = b; vector<int> node; grph.resize(n, node); f1(u, k-1) { grph[u-1].pb(u); } } int add_teleporter(int a, int b) { grph[a].pb(b); f0(u, k) { bool vis[n] = {0}; queue<int> q; q.push(u); vis[u] = 1; while(!q.empty()) { int cur = q.front(); q.pop(); for(int nxt: grph[cur]) { if(vis[nxt]) continue; if(nxt <= u) return 1; q.push(nxt); vis[nxt] = 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...