Submission #335403

#TimeUsernameProblemLanguageResultExecution timeMemory
335403codebuster_10Crocodile's Underground City (IOI11_crocodile)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std ; #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define int long long #define ld long double #define f(i,a,b) for(int i=a;i<b;++i) #define endl '\n' #define debug cout<<"\n========================================\n"; #define err1(a) cout<<#a<<" "<<a<<endl; #define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl; #define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl; #define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl; #define PQ priority_queue #define LB lower_bound #define UB upper_bound #define fr first #define sc second #define all(a) (a).begin(),(a).end() #define allr(a) (a).rbegin(),(a).rend() #define show(a) {for(auto xyz:a)cout<<xyz<<" ";cout<<endl;} #define sz(x) (int)(x).size() const int INF = 1e18 ; void dfs(int i,int p,vector< vector< array<int,2> > > &g,vector<int> &best){ vector<int> V ; for(auto [j,w]:g[i]) if(j!=p){ dfs(j,i,g,best) ; V.push_back(best[j] + w) ; } sort(all(V)) ; best[i] = V[1] ; } int travel_plan(int N, int M, int R[][2],int L[], int K,int P[]){ vector< vector< array<int,2> > > g(N) ; f(i,0,M){ int u = R[i][0], v = R[i][1], w = L[i] ; g[u].push_back({v, w}) ; g[v].push_back({u, w}) ; } vector<int> best(N,-1) ; f(i,0,K) best[P[i]] = 0 ; dfs(0,0,g,best) ; cout << best[0] ; }

Compilation message (stderr)

crocodile.cpp: In function 'long long int travel_plan(long long int, long long int, long long int (*)[2], long long int*, long long int, long long int*)':
crocodile.cpp:48:1: warning: no return statement in function returning non-void [-Wreturn-type]
   48 | }
      | ^
/tmp/ccEvopWd.o: In function `main':
grader.cpp:(.text.startup+0x32): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status