Submission #933620

# Submission time Handle Problem Language Result Execution time Memory
933620 2024-02-26T01:37:48 Z vjudge1 Speedrun (RMI21_speedrun) C++17
Compilation error
0 ms 0 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;
}

Compilation message

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:8:21: error: 'setHintLen' was not declared in this scope
    8 |     if (subtask==1){setHintLen(n);
      |                     ^~~~~~~~~~
speedrun.cpp:10:9: error: 'setHint' was not declared in this scope; did you mean 'setns'?
   10 |         setHint(u[i], v[i], true);
      |         ^~~~~~~
      |         setns
speedrun.cpp:16:5: error: 'setHintLen' was not declared in this scope
   16 |     setHintLen(20);
      |     ^~~~~~~~~~
speedrun.cpp:25:13: error: 'setHint' was not declared in this scope; did you mean 'setns'?
   25 |             setHint(i, bit+1, u>>bit&1);
      |             ^~~~~~~
      |             setns
speedrun.cpp: In function 'const void dfs1(int, int, int)':
speedrun.cpp:35:13: error: 'getHint' was not declared in this scope; did you mean 'getline'?
   35 |         if (getHint(v)) {
      |             ^~~~~~~
      |             getline
speedrun.cpp:36:13: error: 'goTo' was not declared in this scope
   36 |             goTo(v);
      |             ^~~~
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:48:17: error: 'getHint' was not declared in this scope; did you mean 'getline'?
   48 |         root |= getHint(bit+1)<<bit;
      |                 ^~~~~~~
      |                 getline
speedrun.cpp:50:5: error: 'goTo' was not declared in this scope
   50 |     goTo(root);
      |     ^~~~