#include<bits/stdc++.h>
#define mod 1000000007
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);
#define for_t int T;cin>>T;while(T--)
#define endl "\n"
#define rep(n) for(int i=0;i<n;i++)
#define F(i,a,b) for(int i=a;i<b;i++)
#define FR(i,a,b) for(int i=a;i>=b;i--)
#define ll int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
using namespace std;
const int M = 100005;
vector<vector<pair<int,pair<int,bool>>>> vec(1e7);
bool visited[500005];
vector<ll> ans(500005);
void dj(ll a){
if(visited[a]==true) return;
visited[a]=true;
ll temp=vec[a].size();
for(ll i=0;i<temp;i++){
if(vec[a][i].second.second==true) continue;
vec[a][i].second.second=true;
ans[vec[a][i].first]=max(ans[vec[a][i].first],min(ans[a],vec[a][i].second.first));
dj(i);
}
}
void sol()
{
ll v,e,q;
cin>>v>>e>>q;
ll v1,v2,ed;
for(ll i=0;i<v;i++) visited[i]=false;
for(ll i=0;i<v;i++) ans[i]=0;
ans[0]=1e8;
for(ll i=0;i<e;i++){
cin>>v1>>v2>>ed;
vec[v1-1].pb(mp(v2-1,mp(ed,false)));
vec[v2-1].pb(mp(v1-1,mp(ed,false)));
}
dj(0);
ll temp1;
for(ll i=0;i<q;i++){
cin>>temp1;
cout<<ans[temp1-1]<<endl;
}
}
int main()
{
FIO
sol();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
105 ms |
236996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
108 ms |
237256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
131 ms |
240060 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
520 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |