This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "highway.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second
using namespace std;
vector<vector<pair<int, int> > > adj;
int n, m, cost;
int find(int indx, int par = -1) {
for (pair<int, int> next : adj[indx]) {
if (next.ff == par) continue;
vector<int> q(m, 0);
q[next.ss] = 1;
if (ask(q) != cost) return find(next.ff, indx);
}
return indx;
}
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
n = n, m = U.size();
adj.resize(N);
for (int i = 0; i < m; i++) {
adj[U[i]].pb({V[i], i});
adj[V[i]].pb({U[i], i});
}
vector<int> q(m, 0);
cost = ask(q);
answer(0, find(0));
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |