답안 #860328

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860328 2023-10-12T15:40:29 Z ASN49K Speedrun (RMI21_speedrun) C++14
컴파일 오류
0 ms 0 KB
void assignHints (int subtask , int n, int a[], int b[])
{
    vector<vector<int>>g(n+1);
    setHintLen(20);
    for(int i=1;i<n;i++)
    {
        g[a[i]].pb(b[i]);
        g[b[i]].pb(a[i]);
    }
    vector<int>nodes;
    function<void(int,int)>dfs=[&](int x,int tt)
    {
        for(int i=0;i<10;i++)
        {
            setHint(x,i,tt&(1<<i)>0);
        }
        nodes.pb(x);
    };
    dfs(1,0);
    nodes.pb(0);
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<10;j++)
        {
            setHint(nodes[i-1],j+10,nodes[i]&(1<<j)>0);
        }
    }
}
void speedrun(int subtask , int n, int x )
{
    auto tata=[&]()
    {
        int sol=0;
        for(int i=0;i<10;i++)
        {
            if(getHint(i))
            {
                sol|=(1<<i);
            }
        }
        return sol;
    };
    auto next=[&]()
    {
        int sol=0;
        for(int i=0;i<10;i++)
        {
            if(getHint(i+10))
            {
                sol|=(1<<i);
            }
        }
        return sol;
    };
    while(x!=1)
    {
        x=tata();
        goTo(x);
    }
    for(int i=1;i<n;i++)
    {
        int urm=next();
        while(!goTo(urm))
        {
            goTo(tata());
        }
    }
}

Compilation message

speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:3:5: error: 'vector' was not declared in this scope
    3 |     vector<vector<int>>g(n+1);
      |     ^~~~~~
speedrun.cpp:3:19: error: expected primary-expression before 'int'
    3 |     vector<vector<int>>g(n+1);
      |                   ^~~
speedrun.cpp:4:5: error: 'setHintLen' was not declared in this scope
    4 |     setHintLen(20);
      |     ^~~~~~~~~~
speedrun.cpp:7:9: error: 'g' was not declared in this scope
    7 |         g[a[i]].pb(b[i]);
      |         ^
speedrun.cpp:10:12: error: expected primary-expression before 'int'
   10 |     vector<int>nodes;
      |            ^~~
speedrun.cpp:11:5: error: 'function' was not declared in this scope; did you mean 'union'?
   11 |     function<void(int,int)>dfs=[&](int x,int tt)
      |     ^~~~~~~~
      |     union
speedrun.cpp:11:26: error: expression list treated as compound expression in functional cast [-fpermissive]
   11 |     function<void(int,int)>dfs=[&](int x,int tt)
      |                          ^
speedrun.cpp:11:14: error: expected primary-expression before 'void'
   11 |     function<void(int,int)>dfs=[&](int x,int tt)
      |              ^~~~
speedrun.cpp:19:5: error: 'dfs' was not declared in this scope
   19 |     dfs(1,0);
      |     ^~~
speedrun.cpp:20:5: error: 'nodes' was not declared in this scope
   20 |     nodes.pb(0);
      |     ^~~~~
speedrun.cpp:25:13: error: 'setHint' was not declared in this scope
   25 |             setHint(nodes[i-1],j+10,nodes[i]&(1<<j)>0);
      |             ^~~~~~~
speedrun.cpp: In lambda function:
speedrun.cpp:36:16: error: 'getHint' was not declared in this scope
   36 |             if(getHint(i))
      |                ^~~~~~~
speedrun.cpp: In lambda function:
speedrun.cpp:48:16: error: 'getHint' was not declared in this scope
   48 |             if(getHint(i+10))
      |                ^~~~~~~
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:58:9: error: 'goTo' was not declared in this scope
   58 |         goTo(x);
      |         ^~~~
speedrun.cpp:63:16: error: 'goTo' was not declared in this scope
   63 |         while(!goTo(urm))
      |                ^~~~