제출 #399720

#제출 시각아이디문제언어결과실행 시간메모리
399720A_DFun Tour (APIO20_fun)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
const int N=5011;
set<int> g[N];
int n,uu;
int d;
void dfs(int u,int p,int dep)
{
    if(dep>d){
        d=dep;
        uu=u;
    }
    for(auto x:g[u]){
        if(x==p)continue;
        dfs(x,u,dep+1);
    }
}
std::vector<int> createFunTour(int N, int Q) {
    //int H = hoursRequired(0, N - 1);
    //int A = attractionsBehind(0, N - 1);
    return std::vector<int>(N);
    n=N;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int h=hoursRequired(i, j);
            if(h==1){
                g[i].insert(j);
                g[j].insert(i);
            }
        }
    }
    vector<int> ret;
    d=0;
    dfs(uu,uu,0);
    while(st[u].empty()==0){
        d=0;
        int v=uu;
        ret.push_back(v);
        dfs(uu,uu,0);
        int x=*st[v].begin();
        st[v].erase(x);
        st[x].erase(v);
    }
    return ret;
}

컴파일 시 표준 에러 (stderr) 메시지

fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:25:19: error: 'hoursRequired' was not declared in this scope
   25 |             int h=hoursRequired(i, j);
      |                   ^~~~~~~~~~~~~
fun.cpp:35:11: error: 'st' was not declared in this scope; did you mean 'std'?
   35 |     while(st[u].empty()==0){
      |           ^~
      |           std
fun.cpp:35:14: error: 'u' was not declared in this scope
   35 |     while(st[u].empty()==0){
      |              ^