Submission #737063

# Submission time Handle Problem Language Result Execution time Memory
737063 2023-05-06T14:12:16 Z mjhmjh1104 Speedrun (RMI21_speedrun) C++17
21 / 100
52 ms 848 KB
#include "speedrun.h"
#include <vector>
using namespace std;

int n;
vector<int> adj[1006];

void assignHints(int subtask, int n, int a[], int b[]) {
    ::n = n;
    for (int i = 1; i < n; i++) {
        adj[a[i] - 1].push_back(b[i] - 1);
        adj[b[i] - 1].push_back(a[i] - 1);
    }
    setHintLen(n);
    for (int i = 0; i < n; i++) for (auto &j: adj[i]) setHint(i + 1, j + 1, true);
}

void dfs(int x, int prev = -1) {
    for (int i = 0; i < n; i++) if (getHint(i + 1)) adj[x].push_back(i);
    for (auto &i: adj[x]) if (i != prev) {
        goTo(i + 1);
        dfs(i, x);
    }
    if (prev != -1) goTo(prev + 1);
}

void speedrun(int subtask, int n, int st) {
    ::n = n;
    dfs(st - 1);
}
# Verdict Execution time Memory Grader output
1 Correct 33 ms 804 KB Output is correct
2 Correct 38 ms 848 KB Output is correct
3 Correct 45 ms 848 KB Output is correct
4 Correct 52 ms 812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB The length is too large
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB The length is too large
2 Halted 0 ms 0 KB -