제출 #1000758

#제출 시각아이디문제언어결과실행 시간메모리
1000758nomuluun경주 (Race) (IOI11_race)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll N, K; ll H[200005][2]; ll L[200005]; bool vis[200005]={0}; vector<pair<int,int>>v[200005]; ll mi=INT_MAX; void dfs(ll q, ll dis, ll hi){ int m=v[q].size(); if(dis==K){ mi=min(mi,hi); } for(int i=0; i<m; i++){ int k=v[q][i].first; ll cost=v[q][i].second; if(!vis[k]){ vis[k]=1; dfs(k,dis+cost,hi+1); } } } int main(){ cin>>N>>K; for(int i=0; i<N-1; i++){ cin>>H[i][0]>>H[i][1]>>L[i]; } for(int i=0; i<N-1; i++){ v[H[i][0]].push_back({H[i][1], L[i]}); v[H[i][1]].push_back({H[i][0], L[i]}); } for(int i=0; i<=N-1; i++){ for(int i=0; i<N; i++){ vis[i]=0; } vis[i]=1; dfs(i,0,0); } if(mi==INT_MAX) cout<<-1; else cout<<mi; }

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

/usr/bin/ld: /tmp/ccnc7TF2.o: in function `main':
race.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc8e7nNZ.o:grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc8e7nNZ.o: in function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status