Submission #1076168

#TimeUsernameProblemLanguageResultExecution timeMemory
1076168BoasThousands Islands (IOI22_islands)C++17
6.75 / 100
83 ms13712 KiB
#include "islands.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define loop(x, i) for (int i = 0; i < x; i++) #define rev(x, i) for (int i = (int)x - 1; i >= 0; i--) #define ALL(x) begin(x), end(x) #define sz(x) (int)x.size() typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<bool> vb; typedef vector<int> vi; typedef vector<vi> vvi; variant<bool, vi> find_journey(int N, int M, vi U, vi V) { if (N == 2) { vi heen, terug; loop(M, i) { if (U[i] == 0) heen.pb(i); else terug.pb(i); } if (sz(heen) >= 2 && sz(terug) >= 1) { return vi{heen[0], terug[0], heen[1], heen[0], terug[0], heen[1]}; } return false; } else { vvi adj(N); map<ii, int> ix; loop(M, i) { ix[{U[i], V[i]}] = i; adj[U[i]].pb(V[i]); } return M > 2 * (N - 1); /*or (int start : adj[0]) { vi route = {0, start}; vb vis(N); vis[0] = 1; auto dfs = [&](auto &&self, int i) -> bool { route.pb(i); vis[i] = 1; for (int j : adj[i]) { if (j == 0) { route.pb(j); return; } if (vis[j]) continue; self(self, j); } }; } vi a = {ix[{0, i1}], ix[{i1, i2}], ix[{i2, 0}]}; vi b = {ix[{0, i2}], ix[{i2, i1}], ix[{i1, 0}]}; vi res; for (int p : a) res.pb(p); for (int p : b) res.pb(p); rev(3, i) res.pb(a[i]); rev(3, i) res.pb(b[i]); return res;*/ } }
#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...