답안 #860329

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860329 2023-10-12T15:41:18 Z ASN49K Speedrun (RMI21_speedrun) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
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:6:5: error: 'setHintLen' was not declared in this scope
    6 |     setHintLen(20);
      |     ^~~~~~~~~~
speedrun.cpp:9:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'pb'
    9 |         g[a[i]].pb(b[i]);
      |                 ^~
speedrun.cpp:10:17: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'pb'
   10 |         g[b[i]].pb(a[i]);
      |                 ^~
speedrun.cpp: In lambda function:
speedrun.cpp:17:34: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   17 |             setHint(x,i,tt&(1<<i)>0);
      |                            ~~~~~~^~
speedrun.cpp:17:13: error: 'setHint' was not declared in this scope; did you mean 'setns'?
   17 |             setHint(x,i,tt&(1<<i)>0);
      |             ^~~~~~~
      |             setns
speedrun.cpp:19:15: error: 'class std::vector<int>' has no member named 'pb'
   19 |         nodes.pb(x);
      |               ^~
speedrun.cpp: In function 'void assignHints(int, int, int*, int*)':
speedrun.cpp:22:11: error: 'class std::vector<int>' has no member named 'pb'
   22 |     nodes.pb(0);
      |           ^~
speedrun.cpp:27:52: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   27 |             setHint(nodes[i-1],j+10,nodes[i]&(1<<j)>0);
      |                                              ~~~~~~^~
speedrun.cpp:27:13: error: 'setHint' was not declared in this scope; did you mean 'setns'?
   27 |             setHint(nodes[i-1],j+10,nodes[i]&(1<<j)>0);
      |             ^~~~~~~
      |             setns
speedrun.cpp: In lambda function:
speedrun.cpp:38:16: error: 'getHint' was not declared in this scope; did you mean 'getline'?
   38 |             if(getHint(i))
      |                ^~~~~~~
      |                getline
speedrun.cpp: In lambda function:
speedrun.cpp:50:16: error: 'getHint' was not declared in this scope; did you mean 'getline'?
   50 |             if(getHint(i+10))
      |                ^~~~~~~
      |                getline
speedrun.cpp: In function 'void speedrun(int, int, int)':
speedrun.cpp:60:9: error: 'goTo' was not declared in this scope
   60 |         goTo(x);
      |         ^~~~
speedrun.cpp:65:16: error: 'goTo' was not declared in this scope
   65 |         while(!goTo(urm))
      |                ^~~~