Submission #573443

#TimeUsernameProblemLanguageResultExecution timeMemory
573443sumit_kk10Game (APIO22_game)C++17
30 / 100
4043 ms26904 KiB
#include "game.h" #include<bits/stdc++.h> #define pb push_back #define F first #define S second using namespace std; const int M = 1e6 + 5, MOD = 1e9 + 7; int N, K, col[M]; vector<int> g[M]; void init(int n, int k) { N = n, K = k; for(int i = 0; i < k - 1; ++i) g[i].pb(i + 1); } bool dfs(int node){ col[node] = 1; bool cur = 0; for(auto k : g[node]){ if(col[k] == 0) cur |= dfs(k); else if(col[k] == 1){ if(k < K) cur |= 1; } } col[node] = 2; return cur; } int add_teleporter(int u, int v) { if(N == K){ if(u >= v) return 1; return 0; } if(u < K and v < K) if(u >= v) return 1; for(int i = 0; i < N; ++i) col[i] = 0; g[u].pb(v); return dfs(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...