답안 #306381

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
306381 2020-09-25T10:46:27 Z juggernaut 꿈 (IOI13_dreaming) C++14
컴파일 오류
0 ms 0 KB
#include"dreaming.h"
//#include"grader.c"
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
vector<pair<int,int>>g[100005];
bool vis[100005];
int diam,mx[100005],mm,id;
void dia(int v,int p,int depth){
    mx[v]=max(mx[v],depth);
    if(depth>mm){
        mm=depth;
        id=v;
    }
    for(auto to:g[v])if(to.fr!=p)dfs(to.fr,v,depth+to.sc);
}
void go(int v,int p){
    mm=min(mm,mx[v]);
    for(auto to:g[v])if(to.fr!=p)go(to.fr,v);
}
int travelTime(int n,int m,int l,int x[],int y[],int z[]){
    for(int i=0;i<m;i++){
        g[x[i]].push_back({y[i],z[i]});
        g[y[i]].push_back({x[i],z[i]});
    }
    vector<int>st;
    for(int i=0;i<n;i++)if(!vis[i]){
        mm=0;
        dfs(i,i,0);
        mm=0;
        dfs(id,id,0);
        mm=0;
        dfs(id,id,0);
        mm=2e9;
        go(i,i);
        st.push_back(mm);
    }
    sort(st.begin(),st.end(),greater<int>());
    g[n].clear();
    if(st.size()==1)return diam;
    else if(st.size()==2)return max(diam,st[0]+st[1]+l);
    else return max(diam,max(st[0]+st[1]+l,st[1]+st[2]+2*l));
}

Compilation message

dreaming.cpp: In function 'void dia(int, int, int)':
dreaming.cpp:16:34: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   16 |     for(auto to:g[v])if(to.fr!=p)dfs(to.fr,v,depth+to.sc);
      |                                  ^~~
      |                                  ffs
dreaming.cpp: In function 'int travelTime(int, int, int, int*, int*, int*)':
dreaming.cpp:30:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   30 |         dfs(i,i,0);
      |         ^~~
      |         ffs