Submission #504836

# Submission time Handle Problem Language Result Execution time Memory
504836 2022-01-10T09:08:54 Z socpite Speedrun (RMI21_speedrun) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include<speedrun.h>
using namespace std;

vector<vector<int>> graph;
vector<int> order;

void sh(int pos, int id, int val){
    for(int i = 0; i < 10; i++){
        setHint(pos, i + id*10, val&(1<<i));
    }
}

void DFS(int x, int p){
    sh(x, 0, p);
    order.push_back(x);
    for(auto v: graph[x])if(v!=p)DFS(v, x);
}

int gtval(int id){
    int re = 0;
    for(int i = 0; i < 10; i++){
        re|=(getHint(i+id*10)<<i);
    }
    return re;
}

void assignHints (int subtask , int N, int A[], int B[]){
    setHintLen(20);
    graph.resize(n+1);
    for(int i = 1; i < n; i++){
        graph[A[i]].push_back(B[i]);
        graph[B[i]].push_back(A[i]);
    }
    DFS(1, 0);
    for(int i = 0; i < n-1; i++){
        sh(order[i], 1, order[i+1]);
    }
    sh(order[n-1], 1, 0);
}

void speedrun(int subtask , int N, int start ){
    int suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu = getLength();
    while(gtval(0)){
        goTo(gtval(0));
    }
    int curr = gtval(1);
    while(curr){
        while(!goTo(curr))goTo(gtval(0));
        curr = gtval(1);
    }
}

Compilation message

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:30:18: error: 'n' was not declared in this scope
   30 |     graph.resize(n+1);
      |                  ^
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:43:9: warning: unused variable 'suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu' [-Wunused-variable]
   43 |     int suuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu = getLength();
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~