#include "highway.h"
#include "bits/stdc++.h"
using namespace std;
int n, m;
vector<int> pe;
vector<int> dep;
vector<int> in_dep;
vector<vector<pair<int,int>>> g;
void Dfs (int v, int p) {
in_dep[dep[v]] = v;
for (auto [u, i] : g[v]) {
if (u == p) {
continue;
}
pe[u] = i;
dep[u] = dep[v] + 1;
Dfs(u, v);
}
}
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
n = N;
g.resize(n);
pe.resize(n);
dep.resize(n);
in_dep.resize(n);
m = (int) U.size();
for (int i = 0; i < m; ++i) {
g[U[i]].push_back({V[i], i});
g[V[i]].push_back({U[i], i});
}
Dfs(0, 0);
vector<int> w(m, 0);
long long dis = ask(w);
int depT = dis / A;
assert(depT != 0);
int l = -1, r = m - 1;
while (l < r) {
int mid = (l + r + 1) >> 1;
vector<int> w(m);
for (int i = 0; i <= mid; ++i) {
w[i] = true;
}
if (ask(w) > dis) {
r = mid - 1;
} else {
l = mid;
}
}
answer(l + 1, in_dep[l + 1 + depT]);//S, T
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
1636 KB |
Output is correct |
2 |
Correct |
13 ms |
2968 KB |
Output is correct |
3 |
Correct |
34 ms |
4360 KB |
Output is correct |
4 |
Correct |
58 ms |
12624 KB |
Output is correct |
5 |
Correct |
52 ms |
12620 KB |
Output is correct |
6 |
Correct |
58 ms |
12616 KB |
Output is correct |
7 |
Correct |
86 ms |
12632 KB |
Output is correct |
8 |
Correct |
62 ms |
12620 KB |
Output is correct |
9 |
Correct |
66 ms |
12628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
22 ms |
15248 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1797 ms |
15332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |