#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
#define SIZE(x) (int)x.size()
#define ll long long
vector <vector <int>> adj;
map <pair <int, int>, int> m;
vector <int> h;
int s = -1, t = -1;
void DFS(ll dist, int u = 0, int p = -1) {
int c = 0;
for (int v:adj[u]) {
if (c >= 2) {
return;
}
if (v == p) {
c++;
continue;
}
h[m[{u,v}]] = 1;
bool b = ask(h) > dist;
h[m[{u,v}]] = 0;
c += b;
if (b) {
DFS(dist, v, u);
}
if (c >= 2) {
return;
}
}
if (s == -1) {
s = u;
} else if (t == -1) {
t = u;
} else {
cerr << "error: " << u << endl;
}
}
void find_pair(int N, vector<int> U, vector<int> V, int A, int B) {
if (A > B) {
return;
}
adj.resize(N);
int M = SIZE(U);
h.assign(M, 0);
for (int i=0; i<M; i++) {
adj[V[i]].push_back(U[i]);
adj[U[i]].push_back(V[i]);
m[{V[i], U[i]}] = i;
m[{U[i], V[i]}] = i;
}
DFS(ask(h));
answer(s, t);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
464 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
2288 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
464 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
2384 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
2336 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |