Submission #582413

#TimeUsernameProblemLanguageResultExecution timeMemory
582413VanillaHighway Tolls (IOI18_highway)C++17
5 / 100
233 ms262144 KiB
#include <bits/stdc++.h> #include "highway.h" typedef long long int64; using namespace std; const int maxn = 9e4 + 2; const int maxm = 13e4 + 2; vector <pair <int, int> > ad [maxn]; vector <int> w; int n; int64 len, a, b; bool done = 0; void dfs (int u, int p, int64 d = 0) { if (done) return; if (d == len && ask(w) == len * b) { answer(0, u); done = 1; return; } for (pair <int, int> v: ad[u]) { if (v.first == p) continue; w[v.second] = 1; dfs(v.first, u, d + 1); w[v.second] = 0; } } void find_pair(int N, vector<int> u, vector<int> v, int A, int B) { int m = u.size(); n = N, a = A, b = B; for (int i = 0; i < m; i++){ ad[u[i]].push_back({v[i], i}); ad[v[i]].push_back({u[i], i}); } for (int i = 0; i < m; i++){ w.push_back(0); } len = ask(w) / a; dfs(0, -1); assert(done); }
#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...