Submission #957606

#TimeUsernameProblemLanguageResultExecution timeMemory
957606vjudge1Game (APIO22_game)C++17
2 / 100
7 ms25432 KiB
#include <bits/stdc++.h> #define f first #define s second #define ent '\n' //#define int long long #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC optimize("Ofast,unroll-loops,fast-math,O3") const int dx[]={-1, 1, 0, 0, 0}; const int dy[]={0, 0, 1, -1, 0}; typedef long long ll; using namespace std; const int mx=1e6+12; const int mod=998244353; const bool T=1; vector<int> g[mx]; int used[mx]; int n,m,k; int timer; bool ans; void init(int N, int K) { n=N, k=K; timer++; for(int i=0;i<k-1;i++){ g[i].push_back(i+1); } } bool check(int v){ used[v]=timer; for(int to:g[v]){ if(used[to]==timer){ return 1; } if(used[to]<timer && check(to)){ return 1; } } used[v]=timer+1; return 0; } int add_teleporter(int u, int v) { if(ans){ return 1; } g[u].push_back(v); for(int i=0;i<k;i++){ if(used[i]<timer && check(i)){ ans=1; return 1; } } timer+=2; 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...