QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#786973#2810. SpeedrunBulaCompile Error//C++171.3kb2024-11-27 04:52:502024-11-27 04:52:51

Judging History

你现在查看的是最新测评结果

  • [2024-11-27 04:52:51]
  • 评测
  • [2024-11-27 04:52:50]
  • 提交

speedrun

const int Nx = 1e3 + 5;
vector<int> adj[Nx], par(Nx), ord;
void dfs(int v, int p){
    par[v] = p;
    ord.push_back(v);
    for(auto x : adj[v]){
        if(x == p) continue;
        dfs(x, v);
    }
}
void assignHints(int subtask, int n, int A[], int B[]){
    for(int i = 1; i <= n - 1; i++){
        adj[A[i]].push_back(B[i]);
        adj[B[i]].push_back(A[i]);
    }
    setHintLen(20); 
    dfs(1, 0);
    for(int i = 1; i <= n; i++){
        for(int j = 0; j < 10; j++){
            if(par[i] & (1 << j)) setHint(i, j + 1, 1);
        }
    }
    for(int i = 1; i < ord.size(); i++){
        for(int j = 0; j < 10; j++){
            if(ord[i] & (1 << j)) setHint(ord[i - 1], j + 11, 1);
        }
    }
}

void speedrun(int subtask, int n, int start){
    int cur = start, targ = 0;
    set<int> st;
    while(st.size() < n){
        st.insert(cur);
        int p = 0, nxt = 0;
        for(int j = 1; j <= 10; j++){
            p += getHint(j) * (1 << (j - 1));
            nxt += getHint(j + 10) * (1 << (j - 1));
        }
        if(targ > 0 && goTo(targ)){
            cur = targ;
            targ = 0;
        }else if(nxt > 0 && st.find(nxt) == st.end() && goTo(nxt)){
            cur = nxt;
        }
        else{
            goTo(p);
            cur = p;
            targ = nxt;
        }
    }
}

详细

speedrun.code:2:1: error: ‘vector’ does not name a type
    2 | vector<int> adj[Nx], par(Nx), ord;
      | ^~~~~~
speedrun.code: In function ‘void dfs(int, int)’:
speedrun.code:4:5: error: ‘par’ was not declared in this scope
    4 |     par[v] = p;
      |     ^~~
speedrun.code:5:5: error: ‘ord’ was not declared in this scope
    5 |     ord.push_back(v);
      |     ^~~
speedrun.code:6:18: error: ‘adj’ was not declared in this scope
    6 |     for(auto x : adj[v]){
      |                  ^~~
speedrun.code: In function ‘void assignHints(int, int, int*, int*)’:
speedrun.code:13:9: error: ‘adj’ was not declared in this scope
   13 |         adj[A[i]].push_back(B[i]);
      |         ^~~
speedrun.code:16:5: error: ‘setHintLen’ was not declared in this scope
   16 |     setHintLen(20);
      |     ^~~~~~~~~~
speedrun.code:20:16: error: ‘par’ was not declared in this scope
   20 |             if(par[i] & (1 << j)) setHint(i, j + 1, 1);
      |                ^~~
speedrun.code:20:35: error: ‘setHint’ was not declared in this scope
   20 |             if(par[i] & (1 << j)) setHint(i, j + 1, 1);
      |                                   ^~~~~~~
speedrun.code:23:24: error: ‘ord’ was not declared in this scope
   23 |     for(int i = 1; i < ord.size(); i++){
      |                        ^~~
speedrun.code:25:35: error: ‘setHint’ was not declared in this scope
   25 |             if(ord[i] & (1 << j)) setHint(ord[i - 1], j + 11, 1);
      |                                   ^~~~~~~
speedrun.code: In function ‘void speedrun(int, int, int)’:
speedrun.code:32:5: error: ‘set’ was not declared in this scope
   32 |     set<int> st;
      |     ^~~
speedrun.code:32:9: error: expected primary-expression before ‘int’
   32 |     set<int> st;
      |         ^~~
speedrun.code:33:11: error: ‘st’ was not declared in this scope; did you mean ‘std’?
   33 |     while(st.size() < n){
      |           ^~
      |           std
speedrun.code:37:18: error: ‘getHint’ was not declared in this scope
   37 |             p += getHint(j) * (1 << (j - 1));
      |                  ^~~~~~~
speedrun.code:40:24: error: ‘goTo’ was not declared in this scope
   40 |         if(targ > 0 && goTo(targ)){
      |                        ^~~~
grader_speedrun.cpp: In function ‘int readvalue()’:
grader_speedrun.cpp:9:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   fscanf(input, "%d", &val);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~