Submission #897389

#TimeUsernameProblemLanguageResultExecution timeMemory
897389Sir_Ahmed_ImranDreaming (IOI13_dreaming)C++17
Compilation error
0 ms0 KiB
///~~~LOTA~~~/// #include "dreaming.h" #include <bits/stdc++.h> using namespace std; #define nl '\n' #define ff first #define ss second #define ll long long #define append push_back #define pii pair<int,int> #define all(x) (x).begin(),(x).end() #define N 100000 int r; int vis[N]; int dp1[N]; int dp2[N]; int dp3[N]; vector<pii> a[N]; void dfs(int v){ vis[v]=1; for(auto& i:a[v]){ if(vis[i.ff]) continue; dfs(i.ff); if(dp1[i.ff]+i.ss>dp1[v]){ dp2[v]=dp1[v]; dp1[v]=dp1[i.ff]+i.ss; } else dp2[v]=max(dp2[v],dp1[i.ff]+i.ss); } } int dfs2(int v,int u){ r=max(r,dp1[v]+dp2[v]); r=max(r,dp1[v]+dp3[v]); int o=max(dp1[v],dp3[v]); for(auto& i:a[v]){ if(i.ff==u) continue; dp3[i.ff]=dp3[v]+i.ss; if(dp1[i.ff]+i.ss==dp1[v]) dp3[i.ff]=max(dp3[i.ff],dp2[v]+i.ss); else dp3[i.ff]=max(dp3[i.ff],dp1[v]+i.ss); o=min(o,dfs2(i.ff,v)); } return o; } int travelTime(int n,int m,int l,vector<int> p,vector<int> q,vector<int> t){ for(int i=r=0;i<m;i++){ a[p[i]].append({q[i],t[i]}); a[q[i]].append({p[i],t[i]}); } vector<int> v; for(int i=0;i<n;i++){ if(vis[i]) continue; dfs(i); v.append(dfs2(i,-1)); } sort(all(v)); v.back()-=l; sort(all(v)); reverse(all(v)); if(v.size()>1) r=max(r,v[0]+v[1]+2*l); return r; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccIWGO9C.o: in function `main':
grader.c:(.text.startup+0xd1): undefined reference to `travelTime'
collect2: error: ld returned 1 exit status