제출 #679346

#제출 시각아이디문제언어결과실행 시간메모리
679346Hiennoob123Commuter Pass (JOI18_commuter_pass)C++14
0 / 100
143 ms31532 KiB
#include<bits/stdc++.h> #define ll long long #define int long long #define ld long double #define cd complex<ld> #define pll pair<ll,ll> #define pii pair<int,int> #define pld pair<ld,ld> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ll n, m; vector<pll> T[100005]; ll save[4]; ll dis[4][10005]; bool chk[100005]; bool in[100005]; ll dp[100005]; ll sum[100005]; vector<ll> adj[100005]; ll ans = LLONG_MAX; void dijsktra(ll type) { for(int i = 1; i<= n; i++) dis[type][i] = LLONG_MAX; for(int i = 1; i<= n; i++) chk[i] = 0; priority_queue<pll,vector<pll>, greater<pll>> q; dis[type][save[type]] = 0; q.push(mp(0 , save[type])); } void dfs(ll v) { for(auto x: adj[v]) { dfs(x); dp[v] = min(dp[v], dp[x]); } ans = min(ans, dp[v]+sum[v]); } void solve() { cin >> n >> m; cin >> save[2] >> save[3] >> save[0] >> save[1]; for(int i = 0 ;i< m; i++) { ll a, b, c; cin >> a >> b >> c; T[a].push_back(mp(b,c)); T[b].push_back(mp(a,c)); } dijsktra(2); dijsktra(3); } signed main() { //freopen("IN.txt","r",stdin); //freopen("OUT.txt","w",stdout); ios_base::sync_with_stdio(NULL) ; cin.tie(nullptr) ; cout.tie(nullptr); ll t = 1; //cin >> t; while(t--) { solve(); cout << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...