Submission #974027

#TimeUsernameProblemLanguageResultExecution timeMemory
974027Tuanlinh123Game (APIO22_game)C++17
0 / 100
1 ms2648 KiB
#include "game.h" #include<bits/stdc++.h> #define ll long long #define pll pair<ll, ll> #define pb push_back #define mp make_pair #define fi first #define se second #define ld long double #define sz(a) ((ll)(a).size()) using namespace std; const ll maxn=30005, maxk=1024; ll n, k; vector <ll> A[maxn]; bitset <maxk> check[maxn]; void init(int N, int K) { n=N, k=K; for (ll i=0; i<k; i++) for (ll j=i+1; j<k; j++) check[i][j]=1; } int add_teleporter(int u, int v) { A[u].pb(v); for (ll i=0; i<k; i++) { if (!check[i][u]) continue; queue <ll> q; q.push(v), check[i][v]=1; while (sz(q)) { ll x=q.front(); q.pop(); if (x<=i) return 1; for (ll y:A[x]) if (!check[i][y]) check[i][y]=1, q.push(y); } } 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...