#include <bits/stdc++.h>
#include "highway.h"
typedef long long int64;
using namespace std;
const int maxn = 9e4 + 2;
const int maxm = 13e4 + 2;
vector <pair <int, int> > ad [maxn];
vector <int> w;
int n;
int64 len, a, b, lastlen = 1e9;
bool done = 0;
void dfs (int u, int p, int64 d = 0) {
if (done || u > lastlen) return;
if (d == len) {
lastlen = ask(w) / b;
if (lastlen == len){
answer(0, u);
done = 1;
}
return;
}
for (pair <int, int> v: ad[u]) {
if (v.first == p) continue;
w[v.second] = 1;
dfs(v.first, u, d + 1);
if (lastlen == d) lastlen = 1e9;
w[v.second] = 0;
}
}
void find_pair(int N, vector<int> u, vector<int> v, int A, int B) {
int m = u.size();
n = N, a = A, b = B;
for (int i = 0; i < m; i++){
ad[u[i]].push_back({v[i], i});
ad[v[i]].push_back({u[i], i});
}
for (int i = 0; i < m; i++){
w.push_back(0);
}
len = ask(w) / a;
dfs(0, -1);
assert(done);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2384 KB |
Output is correct |
2 |
Correct |
3 ms |
2384 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
2 ms |
2384 KB |
Output is correct |
5 |
Correct |
1 ms |
2384 KB |
Output is correct |
6 |
Correct |
2 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
2 ms |
2384 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
2384 KB |
Output is correct |
11 |
Correct |
2 ms |
2384 KB |
Output is correct |
12 |
Correct |
2 ms |
2384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2384 KB |
Output is correct |
2 |
Correct |
18 ms |
3000 KB |
Output is correct |
3 |
Runtime error |
120 ms |
7716 KB |
Execution killed with signal 13 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
14 ms |
5840 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
4816 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
20 ms |
3064 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
19 ms |
6068 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |