Submission #638478

#TimeUsernameProblemLanguageResultExecution timeMemory
638478NeltGame (APIO22_game)C++17
0 / 100
0 ms208 KiB
#include "game.h" #include <bits/stdc++.h> #define S second #define F first #define ll long long #define ull unsigned long long #define ld long double #define npos ULLONG_MAX #define INF LLONG_MAX #define elif else if #define vv(a) vector<a> #define pp(a, b) pair<a, b> #define pq(a) priority_queue<a> #define qq(a) queue<a> #define ss(a) set<a> #define mm(a, b) map<a, b> #define ump(a, b) unordered_map<a, b> #define pb push_back #define sync \ ios_base::sync_with_stdio(0); \ cin.tie(); \ cout.tie(); #define endl "\n" #define allc(a) begin(a), end(a) #define all(a) a, a + sizeof(a) / sizeof(a[0]) #define mpr make_pair #define ins insert using namespace std; using namespace __cxx11; typedef char chr; typedef basic_string<chr> str; ll n, k; const ll sz = 1005; vv(ll) g[sz]; ll used[sz]; bool dfs(ll v, ll par = 0) { if (used[v]) return 1; used[v] = 1; for (ll to : g[v]) { if (dfs(to, v) and to != par) return 1; } return 0; } void init(int n1, int k1) { n = n1; k = k1; for (ll i = 1; i < k; i++) g[i].pb(i + 1); } int add_teleporter(int u, int v) { u++, v++; g[u].pb(v); for (ll i = 1; i <= n; i++) used[i] = 0; return dfs(1); }
#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...