Submission #933621

# Submission time Handle Problem Language Result Execution time Memory
933621 2024-02-26T01:37:59 Z vjudge1 Speedrun (RMI21_speedrun) C++17
29 / 100
95 ms 2084 KB
#include <bits/stdc++.h>
#include "speedrun.h"
using namespace std;
using ll = long long;
using vll = vector <ll>;

void assignHints (int subtask, int n, int u[], int v[]) {
    if (subtask==1){setHintLen(n);
    for (int i = 1; i <= n-1; i++) {
        setHint(u[i], v[i], true);
        setHint(v[i], u[i], true);
    }
    return;
    }
    if (subtask==2) {
    setHintLen(20);
    int freq[n+1]{};
    for (int i=1; i <= n-1; i++) {
        freq[u[i]]++;
        freq[v[i]]++;
    }
    int u = max_element(freq, freq+n+1)-freq;
    for (int i=1; i <= n; i++) {
        for (int bit=0; bit < 20; bit++) {
            setHint(i, bit+1, u>>bit&1);
        }
    }
    return;}
}

const static void dfs1 (int u, int par, int n) {
    for (int v = 1; v <= n; v++) {
        if (v == u) continue;
        if (v == par) continue;
        if (getHint(v)) {
            goTo(v);
            dfs1(v, u, n);
            goTo(u);
        }
    }
    return;
};

void speedrun (int subtask, int n, int at) {
    if (subtask==1) {dfs1(at, at, n); return;}
    if (subtask==2) {int root=0;
    for (int bit=0; bit < 20; bit++) {
        root |= getHint(bit+1)<<bit;
    }
    goTo(root);
    for (int u=1; u <= n; u++) {
        if (u==root)continue;
        goTo(u);
        goTo(root);
    }
    return;}
    return;
}
# Verdict Execution time Memory Grader output
1 Correct 26 ms 2052 KB Output is correct
2 Correct 20 ms 1792 KB Output is correct
3 Correct 23 ms 2084 KB Output is correct
4 Correct 21 ms 1576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 1844 KB Output is correct
2 Correct 95 ms 1596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB setHintLen was never called
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 596 KB setHintLen was never called
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB setHintLen was never called
2 Halted 0 ms 0 KB -