結果
問題 | No.1065 電柱 / Pole (Easy) |
ユーザー | umezo |
提出日時 | 2020-05-31 03:46:37 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,393 bytes |
コンパイル時間 | 3,578 ms |
コンパイル使用メモリ | 260,544 KB |
実行使用メモリ | 31,768 KB |
最終ジャッジ日時 | 2024-04-27 15:22:23 |
合計ジャッジ時間 | 8,222 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 10 ms
27,840 KB |
testcase_01 | AC | 10 ms
18,940 KB |
testcase_02 | TLE | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
ソースコード
#define _GLIBCXX_DEBUG #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #include <bits/stdc++.h> using namespace std; #define MAX 200010 #define INF 1000100100 vector<pair<int,double>> vec[MAX]; double d[MAX],color[MAX],p[MAX],q[MAX]; int n,m,x,y; void dijk(int s){ priority_queue<pair<double,int>> pq; for(int i=1;i<=n;i++){ d[i]=INF; color[i]=0; } d[s]=0; pq.push(make_pair(0,s)); while(!pq.empty()){ pair<double,int> f=pq.top(); pq.pop(); int u=f.second; color[u]=2; if(d[u]<f.first*(-1)) continue; for(int j=0;j<vec[u].size();j++){ int v=vec[u][j].first; if(color[v]==2) continue; if(d[v] > d[u]+vec[u][j].second){ d[v]=d[u]+vec[u][j].second; pq.push(make_pair(d[v]*(-1),v)); } } } } int main() { cin>>n>>m>>x>>y; int a,b; double c; rep(i,n) cin>>p[i+1]>>q[i+1]; rep(i,m){ cin>>a>>b; c=sqrt((p[a]-p[b])*(p[a]-p[b])+(q[a]-q[b])*(q[a]-q[b])); vec[a].push_back(make_pair(b,c)); vec[b].push_back(make_pair(a,c)); } dijk(x); cout<< fixed << setprecision(15) <<d[y]<<endl; return 0; }