#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define ld long double
#define ar array
#define vi vector<ll>
#define vii vector<vector<ll>>
#define pii pair<ll, ll>
#define pb push_back
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define endl "\n"
const ll MOD = 1e9+7;
const ll inf = 1e9;
const ll linf = 1e18;
const ll d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const ll d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};
// -------------------------------------------------- Main Code --------------------------------------------------
const ll N = 1005;
vector<array<ll, 2>> g[N];
vi temp[N];
ll dis[N], vis[N];
void dfs(ll src) {
vis[src] = true;
for (auto ch : g[src]) {
ll child = ch[0], wt = ch[1];
if (!vis[child]) {
dfs(child);
temp[src].pb(dis[child]+wt);
dis[src] = min(dis[src], dis[child] + wt);
}
}
if (g[src].size() == 1) dis[src] = 0;
else {
sort (all(temp[src]));
dis[src] = temp[src][1];
}
}
ll travel_plan(ll n, ll m, ll **r, ll* l, ll k, ll *p) {
memset(dis, 63, sizeof dis);
vii edges;
for (ll i = 0; i < m; i++) edges.pb({r[i][0], r[i][1]});
for (ll i = 0; i < m; i++) edges[i].pb(l[i]);
for (ll i = 0; i < k; i++) {
ll x = p[i];
}
for (auto i : edges) {
ll a = i[0], b = i[1], c = i[2];
g[a].pb({b, c});
g[b].pb({a, c});
}
dfs(0);
return dis[0];
}
signed main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t = 1;
// cin >> t;
while (t--) {
sol();
}
return 0;
}
Compilation message
crocodile.cpp: In function 'long long int travel_plan(long long int, long long int, long long int**, long long int*, long long int, long long int*)':
crocodile.cpp:61:12: warning: unused variable 'x' [-Wunused-variable]
61 | ll x = p[i];
| ^
crocodile.cpp: In function 'int main()':
crocodile.cpp:79:9: error: 'sol' was not declared in this scope
79 | sol();
| ^~~