Submission #978520

#TimeUsernameProblemLanguageResultExecution timeMemory
978520TsaganaGame (APIO22_game)C++17
60 / 100
4072 ms21772 KiB
#include "game.h" //OP #include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all(x) x.begin(), x.end() #define pi pair<int, int > #define pq priority_queue #define lb lower_bound #define ub upper_bound #define pb push_back #define eb emplace_back #define mset multiset #define F first #define S second using namespace std; struct graph { int n, k; vector<int> edge[300005]; int cn[300005]; void dfs(int s, int ms) { if (cn[s] <= ms) return ; cn[s] = ms; for (auto i: edge[s]) dfs(i, ms); } void add_edge(int u, int v) { edge[v].pb(u); if (v < k) dfs(u, v); else dfs(u, cn[v]); } int check_stamp() { for (int i = 0; i < k; i++) if (cn[i] <= i) return 1; return 0; } }; graph G; void init(int n, int k) { G.n = n; G.k = k; for (int i = k-1; i < n; i++) G.cn[i] = 1e6; for (int i = 0; i < k-1; i++) { G.cn[i] = i+1; G.add_edge(i, i+1); } } int add_teleporter(int u, int v) { G.add_edge(u, v); return G.check_stamp(); } //ED
#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...