Submission #746842

#TimeUsernameProblemLanguageResultExecution timeMemory
746842tutisGame (APIO22_game)C++17
60 / 100
4075 ms43784 KiB
#include <bits/stdc++.h> using namespace std; const int N = 300000; int K; vector<int>adj[N]; vector<int>adj_[N]; int mn[N]; void init(int n, int k) { K = k; for (int i = 0; i < n; i++) mn[i] = k; } int add_teleporter(int u, int v) { adj[u].push_back(v); adj_[v].push_back(u); int x = min(v, mn[v]); int ret = 0; function<void(int)>dfs = [&](int i) { if (x >= mn[i]) return; mn[i] = x; if (i < K && x <= i) { ret = 1; } for (int j : adj_[i]) { dfs(j); } }; dfs(u); return ret; }
#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...