#include "speedrun.h"
#include <bits/stdc++.h>
using namespace std;
int arr[1005][1005];
void assignHints(int subtask, int N, int A[], int B[]) { /* your solution here */
if (subtask == 1){
for (int i = 1; i < N; i++){
arr[A[i]][B[i]] = arr[B[i]][A[i]] = 1;
}
setHintLen(N);
for (int i = 1; i <= N; i++){
for (int j = 1; j <= N; j++){
if (arr[i][j]) setHint(i,j,arr[i][j]);
}
}
}
}
int n;
int vis[1005];
vector<int> G[1005];
void getG(int u){
for (int i = 1; i <= n; i++){
if (getHint(i)){
//printf("adding edge %d %d\n",u,i);
G[u].push_back(i);
}
}
}
void dfs(int u, int p){
//printf("at %d\n",u);
getG(u);
for (auto v : G[u]){
if (v == p) continue;
//printf("%d %d\n",u,v);
goTo(v);
dfs(v, u);
}
if (p != -1) goTo(p);
}
void speedrun(int subtask, int N, int start) { /* your solution here */
n = N;
if (subtask == 1){
dfs(start, -1);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
4464 KB |
Output is correct |
2 |
Correct |
40 ms |
4596 KB |
Output is correct |
3 |
Correct |
40 ms |
4596 KB |
Output is correct |
4 |
Correct |
40 ms |
4380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
setHintLen was never called |
2 |
Halted |
0 ms |
0 KB |
- |