Submission #414951

#TimeUsernameProblemLanguageResultExecution timeMemory
414951SuhaibSawalha1Highway Tolls (IOI18_highway)C++17
5 / 100
24 ms1088 KiB
#include "highway.h" #include <bits/stdc++.h> using namespace std; vector<vector<array<int, 2>>> adj; int n, m, dp, A, B; void dfs (int u = 0, int p = -1, int d = 1) { for (auto &v : adj[u]) { if (v[0] ^ p) { if (d == dp) { vector<int> ak(m, 0); ak[v[1]] = 1; if (ask(ak) != d * 1LL * A) { answer(0, v[0]); return; } } else { dfs(v[0], u, d + 1); } } } } void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) { n = N; m = U.size(); ::A = A; ::B = B; adj.assign(n, {}); for (int i = 0; i < m; ++i) { adj[U[i]].push_back({V[i], i}); adj[V[i]].push_back({U[i], i}); } dp = ask(vector<int>(m, 0)) / A; dfs(); }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...