제출 #1197259

#제출 시각아이디문제언어결과실행 시간메모리
1197259agussHighway Tolls (IOI18_highway)C++20
5 / 100
230 ms327680 KiB
#include "highway.h" #include <bits/stdc++.h> #define dbg(x) cerr << #x << ": " << x << "\n"; #define dbgv(x) cerr << #x << ": "; for(const auto &i : x) cerr << i << " "; cerr << "\n"; using namespace std; long long dis, a; vector<vector<pair<int, int>>> adj; vector<long long> depth; vector<pair<int, int>> nose; void dfs(int node, int prev){ for(const auto &x : adj[node]){ if(x.first == prev) continue; depth[x.first] = depth[node] + 1; if(depth[x.first] == dis / a){ nose.push_back({x.first, x.second}); } dfs(x.first, node); } } void find_pair(int N, vector<int> U, vector<int> V, int A, int B) { adj.assign(N, vector<pair<int, int>>()); depth.assign(N, 0); vector<int> vec(U.size(), 0); dis = ask(vec); a = A; for(int i = 0; i < (int)U.size(); i++){ adj[U[i]].push_back({V[i], i}); adj[V[i]].push_back({U[i], i}); } dfs(0, 0); for(const auto &i : nose){ vec[i.second] = 1; long long aux = ask(vec); if(aux != dis){ answer(0, i.first); return; } } }
#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...