#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "grader.cpp"
#endif // LOCAL
#define forr(x,i,n) for(int x=i; x<n; x++)
#define pb push_back
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define fi first
#define se second
bool vis[100000];
bool ex[100000];
//int routes[100000];
vector<pii> a[100000];
int dfs(int x, int t)
{
if (ex[x])
{
return t;
}
vector<int> ch;
for(auto y:a[x])
{
if (!vis[y.fi])
{
vis[y.fi]=1;
ch.pb(dfs(y.fi,y.se+t));
vis[y.fi]=0;
}
}
sort(all(ch));
return ch[1];
}
int travel_plan(int n, int m, int r[][2], int l[], int k, int e[])
{
//r/l/k/e/
forr(i,0,m)
{
int x=r[i][0];
int y=r[i][1];
a[x].pb({y,l[i]});
a[y].pb({x,l[i]});
}
forr(i,0,k) ex[e[i]]=1;
vis[0]=1;
return dfs(0,0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6752 KB |
Output is correct |
2 |
Correct |
1 ms |
6748 KB |
Output is correct |
3 |
Correct |
1 ms |
6748 KB |
Output is correct |
4 |
Correct |
1 ms |
6748 KB |
Output is correct |
5 |
Correct |
1 ms |
6752 KB |
Output is correct |
6 |
Correct |
1 ms |
6752 KB |
Output is correct |
7 |
Correct |
1 ms |
6752 KB |
Output is correct |
8 |
Correct |
1 ms |
6748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6752 KB |
Output is correct |
2 |
Correct |
1 ms |
6748 KB |
Output is correct |
3 |
Correct |
1 ms |
6748 KB |
Output is correct |
4 |
Correct |
1 ms |
6748 KB |
Output is correct |
5 |
Correct |
1 ms |
6752 KB |
Output is correct |
6 |
Correct |
1 ms |
6752 KB |
Output is correct |
7 |
Correct |
1 ms |
6752 KB |
Output is correct |
8 |
Correct |
1 ms |
6748 KB |
Output is correct |
9 |
Execution timed out |
2086 ms |
6748 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
6752 KB |
Output is correct |
2 |
Correct |
1 ms |
6748 KB |
Output is correct |
3 |
Correct |
1 ms |
6748 KB |
Output is correct |
4 |
Correct |
1 ms |
6748 KB |
Output is correct |
5 |
Correct |
1 ms |
6752 KB |
Output is correct |
6 |
Correct |
1 ms |
6752 KB |
Output is correct |
7 |
Correct |
1 ms |
6752 KB |
Output is correct |
8 |
Correct |
1 ms |
6748 KB |
Output is correct |
9 |
Execution timed out |
2086 ms |
6748 KB |
Time limit exceeded |
10 |
Halted |
0 ms |
0 KB |
- |