結果
問題 | No.1065 電柱 / Pole (Easy) |
ユーザー | pione |
提出日時 | 2020-05-29 23:03:43 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 222 ms / 2,000 ms |
コード長 | 2,468 bytes |
コンパイル時間 | 1,917 ms |
コンパイル使用メモリ | 179,740 KB |
実行使用メモリ | 21,272 KB |
最終ジャッジ日時 | 2024-11-06 07:23:21 |
合計ジャッジ時間 | 7,448 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
8,268 KB |
testcase_01 | AC | 4 ms
8,776 KB |
testcase_02 | AC | 96 ms
14,280 KB |
testcase_03 | AC | 116 ms
19,692 KB |
testcase_04 | AC | 115 ms
20,284 KB |
testcase_05 | AC | 84 ms
20,388 KB |
testcase_06 | AC | 84 ms
20,208 KB |
testcase_07 | AC | 28 ms
11,204 KB |
testcase_08 | AC | 96 ms
19,068 KB |
testcase_09 | AC | 13 ms
9,164 KB |
testcase_10 | AC | 46 ms
13,636 KB |
testcase_11 | AC | 32 ms
11,332 KB |
testcase_12 | AC | 22 ms
11,204 KB |
testcase_13 | AC | 98 ms
15,256 KB |
testcase_14 | AC | 115 ms
17,508 KB |
testcase_15 | AC | 135 ms
18,416 KB |
testcase_16 | AC | 61 ms
13,468 KB |
testcase_17 | AC | 147 ms
19,092 KB |
testcase_18 | AC | 40 ms
12,696 KB |
testcase_19 | AC | 140 ms
18,508 KB |
testcase_20 | AC | 33 ms
11,032 KB |
testcase_21 | AC | 45 ms
12,136 KB |
testcase_22 | AC | 121 ms
18,088 KB |
testcase_23 | AC | 5 ms
9,028 KB |
testcase_24 | AC | 5 ms
8,464 KB |
testcase_25 | AC | 20 ms
10,312 KB |
testcase_26 | AC | 69 ms
14,080 KB |
testcase_27 | AC | 71 ms
13,448 KB |
testcase_28 | AC | 126 ms
17,332 KB |
testcase_29 | AC | 15 ms
11,076 KB |
testcase_30 | AC | 139 ms
18,160 KB |
testcase_31 | AC | 94 ms
16,888 KB |
testcase_32 | AC | 60 ms
13,260 KB |
testcase_33 | AC | 140 ms
21,272 KB |
testcase_34 | AC | 44 ms
11,628 KB |
testcase_35 | AC | 137 ms
18,372 KB |
testcase_36 | AC | 5 ms
8,644 KB |
testcase_37 | AC | 5 ms
9,544 KB |
testcase_38 | AC | 5 ms
8,728 KB |
testcase_39 | AC | 5 ms
8,600 KB |
testcase_40 | AC | 4 ms
8,404 KB |
testcase_41 | AC | 222 ms
19,912 KB |
testcase_42 | AC | 51 ms
12,228 KB |
testcase_43 | AC | 105 ms
14,660 KB |
testcase_44 | AC | 30 ms
10,560 KB |
testcase_45 | AC | 104 ms
14,172 KB |
testcase_46 | AC | 4 ms
8,308 KB |
testcase_47 | AC | 4 ms
8,516 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; // #define int long long #define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i) #define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i) #define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--) #define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--) #define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i) #define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i) #define SORT(v, n) sort(v, v + n); #define REVERSE(v, n) reverse(v, v+n); #define vsort(v) sort(v.begin(), v.end()); #define all(v) v.begin(), v.end() #define mp(n, m) make_pair(n, m); #define cout(d) cout<<d<<endl; #define coutd(d) cout<<std::setprecision(10)<<d<<endl; #define cinline(n) getline(cin,n); #define replace_all(s, b, a) replace(s.begin(),s.end(), b, a); #define PI (acos(-1)) #define FILL(v, n, x) fill(v, v + n, x); #define sz(x) long long(x.size()) using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using pii = pair<int, int>; using pll = pair<ll, ll>; using vs = vector<string>; using vpll = vector<pair<ll, ll>>; using tll = tuple<ll,ll,ll>; using vtll = vector<tuple<ll,ll,ll>>; using vb = vector<bool>; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } const ll INF = 1e9; const ll MOD = 10000; const ll LINF = 1e18; vll G[200100]; double dist[200100]; signed main() { cin.tie( 0 ); ios::sync_with_stdio( false ); ll n,m; cin>>n>>m; ll x,y; cin>>x>>y; x--,y--; vpll P(n); rep(i,n){ ll a,b; cin>>a>>b; P[i]={a,b}; } rep(i,m){ ll a,b; cin>>a>>b; a--,b--; G[a].push_back(b); G[b].push_back(a); } fill(dist,dist+n,LINF); priority_queue<pair<double,ll>, vector<pair<double,ll>>, greater<pair<double,ll>>> q; q.emplace(0,x); dist[x]=0; while(!q.empty()){ auto p=q.top(); q.pop(); ll v=p.second; double c=p.first; if(dist[v]<c) continue; for(auto nv: G[v]){ double span=sqrt((P[v].first-P[nv].first)*(P[v].first-P[nv].first)+(P[v].second-P[nv].second)*(P[v].second-P[nv].second)); if(chmin(dist[nv],dist[v]+span)){ q.emplace(dist[nv],nv); } } } cout<<std::setprecision(10)<<dist[y]<<endl; }