#include <algorithm>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include "speedrun.h"
// Akhmet Issa
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define ent "\n"
const int maxn = 1e6 + 100;
const ll INF = (ll)2e18;
const int inf = (ll)2e9;
const int maxl = 20;
const int MOD = 1e9 + 7;
vector<int> g[maxn];
int used[maxn];
void assignHints(int subtask, int n, int A [], int B []){
for(int i = 1; i < n; i++){
g[A[i]].push_back(B[i]);
g[B[i]].push_back(A[i]);
}
setHintLen(n);
for(int i = 1; i <= n; i++){
for(int to: g[i]){
setHint(i, to, 1);
}
}
}
void dfs(int v, int pr, int n){
used[v] = 1;
for(int to = 1; to <= n; to++){
if(getHint(to) && !used[to]){
goTo(to);
dfs(to, v, n);
}
}
if(pr) goTo(pr);
}
void speedrun(int subtask, int n, int start){
dfs(start, 0, n);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
59 ms |
47868 KB |
Output is correct |
2 |
Correct |
53 ms |
47728 KB |
Output is correct |
3 |
Correct |
57 ms |
47652 KB |
Output is correct |
4 |
Correct |
54 ms |
47652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
23760 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
23760 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
23780 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
23864 KB |
The length is too large |
2 |
Halted |
0 ms |
0 KB |
- |