結果
問題 | No.1065 電柱 / Pole (Easy) |
ユーザー | hs0319boy |
提出日時 | 2020-05-29 21:52:02 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 338 ms / 2,000 ms |
コード長 | 1,747 bytes |
コンパイル時間 | 2,310 ms |
コンパイル使用メモリ | 176,688 KB |
実行使用メモリ | 23,432 KB |
最終ジャッジ日時 | 2024-04-23 21:43:49 |
合計ジャッジ時間 | 9,162 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
9,728 KB |
testcase_01 | AC | 5 ms
9,856 KB |
testcase_02 | AC | 165 ms
16,384 KB |
testcase_03 | AC | 237 ms
23,432 KB |
testcase_04 | AC | 239 ms
23,180 KB |
testcase_05 | AC | 202 ms
23,180 KB |
testcase_06 | AC | 196 ms
23,048 KB |
testcase_07 | AC | 73 ms
12,936 KB |
testcase_08 | AC | 265 ms
22,028 KB |
testcase_09 | AC | 28 ms
10,736 KB |
testcase_10 | AC | 121 ms
15,232 KB |
testcase_11 | AC | 83 ms
13,548 KB |
testcase_12 | AC | 48 ms
13,440 KB |
testcase_13 | AC | 151 ms
18,624 KB |
testcase_14 | AC | 181 ms
20,156 KB |
testcase_15 | AC | 213 ms
21,176 KB |
testcase_16 | AC | 105 ms
16,692 KB |
testcase_17 | AC | 229 ms
22,192 KB |
testcase_18 | AC | 76 ms
14,720 KB |
testcase_19 | AC | 224 ms
21,416 KB |
testcase_20 | AC | 62 ms
12,928 KB |
testcase_21 | AC | 90 ms
16,488 KB |
testcase_22 | AC | 209 ms
20,676 KB |
testcase_23 | AC | 7 ms
9,852 KB |
testcase_24 | AC | 8 ms
9,856 KB |
testcase_25 | AC | 43 ms
13,044 KB |
testcase_26 | AC | 117 ms
16,792 KB |
testcase_27 | AC | 117 ms
16,828 KB |
testcase_28 | AC | 203 ms
21,756 KB |
testcase_29 | AC | 28 ms
11,776 KB |
testcase_30 | AC | 217 ms
22,156 KB |
testcase_31 | AC | 154 ms
19,216 KB |
testcase_32 | AC | 101 ms
15,560 KB |
testcase_33 | AC | 215 ms
22,772 KB |
testcase_34 | AC | 78 ms
14,720 KB |
testcase_35 | AC | 236 ms
22,668 KB |
testcase_36 | AC | 6 ms
9,956 KB |
testcase_37 | AC | 7 ms
9,984 KB |
testcase_38 | AC | 7 ms
9,920 KB |
testcase_39 | AC | 7 ms
9,928 KB |
testcase_40 | AC | 6 ms
9,724 KB |
testcase_41 | AC | 338 ms
22,528 KB |
testcase_42 | AC | 95 ms
13,568 KB |
testcase_43 | AC | 168 ms
16,512 KB |
testcase_44 | AC | 63 ms
12,416 KB |
testcase_45 | AC | 171 ms
16,384 KB |
testcase_46 | AC | 6 ms
9,712 KB |
testcase_47 | AC | 6 ms
9,600 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; using vin=vector<int>; using vll=vector<long long>; using vvin=vector<vector<int>>; using vvll=vector<vector<long long>>; using vstr=vector<string>; using vvstr=vector<vector<string>>; using vch=vector<char>; using vvch=vector<vector<char>>; using vbo=vector<bool>; using vvbo=vector<vector<bool>>; using vpii=vector<pair<int,int>>; using pqsin=priority_queue<int,vector<int>,greater<int>>; #define mp make_pair #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep2(i,s,n) for(int i=(s);i<(int)(n);i++) #define all(v) v.begin(),v.end() #define decp(n) cout<<fixed<<setprecision((int)n) const double inf=1e9+7; const ll INF=1e18; vector<vector<pair<int,double>>> edge(200050); vector<double> d(200050,inf); void dijkstra(int s){ priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> q; d[s]=0; q.push(mp(0,s)); while(q.size()){ auto p=q.top();q.pop(); auto v=p.second; if(d[v]<p.first)continue; for(auto e:edge[v]){ if(d[e.first]>d[v]+e.second){ d[e.first]=d[v]+e.second; q.push(mp(d[e.first],e.first)); } } } } int main(){ decp(7); int n,m,x,y;cin>>n>>m>>x>>y; vector<pair<double,double>> coor(n); double p,q; rep(i,n){ cin>>p>>q; coor[i]=mp(p,q); } int P,Q;double tmp; rep(i,m){ cin>>P>>Q; tmp=sqrt((coor[P-1].first-coor[Q-1].first)*(coor[P-1].first-coor[Q-1].first)+(coor[P-1].second-coor[Q-1].second)*(coor[P-1].second-coor[Q-1].second)); edge[P].push_back(mp(Q,tmp)); edge[Q].push_back(mp(P,tmp)); } dijkstra(x); cout<<d[y]<<endl; }