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"
using namespace std;
#define sz(x) (int)x.size()
const int MAXN = 9e4;
int M;
vector<pair<int,int>> G[MAXN];
bool vis[MAXN];
vector<int> p;
long long cost;
void DFS(int u, int& ans) {
vis[u] = true;
for(pair<int,int> v : G[u]) {
if(!vis[v.first]) {
p[v.second] = 1;
if(ask(p) > cost) {
p[v.second] = 0;
DFS(v.first, ans);
return;
}
}
}
ans = u;
}
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
M = sz(U);
p = vector<int>(M, 0);
cost = ask(p);
for(int i=0; i<M; i++) {
G[U[i]].push_back({V[i], i});
G[V[i]].push_back({U[i], i});
}
int ans=-1;
DFS(0, ans);
answer(0, ans);
}
# | 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... |