結果
問題 | No.1065 電柱 / Pole (Easy) |
ユーザー | m_9719 |
提出日時 | 2020-05-29 21:39:47 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 200 ms / 2,000 ms |
コード長 | 2,147 bytes |
コンパイル時間 | 2,222 ms |
コンパイル使用メモリ | 175,144 KB |
実行使用メモリ | 24,120 KB |
最終ジャッジ日時 | 2024-04-23 20:39:19 |
合計ジャッジ時間 | 6,823 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
8,704 KB |
testcase_01 | AC | 4 ms
8,576 KB |
testcase_02 | AC | 97 ms
16,184 KB |
testcase_03 | AC | 135 ms
24,116 KB |
testcase_04 | AC | 137 ms
23,868 KB |
testcase_05 | AC | 106 ms
23,860 KB |
testcase_06 | AC | 105 ms
24,120 KB |
testcase_07 | AC | 38 ms
12,092 KB |
testcase_08 | AC | 130 ms
22,076 KB |
testcase_09 | AC | 15 ms
9,812 KB |
testcase_10 | AC | 59 ms
14,516 KB |
testcase_11 | AC | 42 ms
12,468 KB |
testcase_12 | AC | 25 ms
12,032 KB |
testcase_13 | AC | 94 ms
18,488 KB |
testcase_14 | AC | 116 ms
21,044 KB |
testcase_15 | AC | 135 ms
21,812 KB |
testcase_16 | AC | 63 ms
15,696 KB |
testcase_17 | AC | 143 ms
22,968 KB |
testcase_18 | AC | 44 ms
13,880 KB |
testcase_19 | AC | 132 ms
21,820 KB |
testcase_20 | AC | 38 ms
11,956 KB |
testcase_21 | AC | 50 ms
15,104 KB |
testcase_22 | AC | 123 ms
21,688 KB |
testcase_23 | AC | 5 ms
8,960 KB |
testcase_24 | AC | 6 ms
8,960 KB |
testcase_25 | AC | 24 ms
11,904 KB |
testcase_26 | AC | 77 ms
16,056 KB |
testcase_27 | AC | 75 ms
16,564 KB |
testcase_28 | AC | 133 ms
22,204 KB |
testcase_29 | AC | 17 ms
11,136 KB |
testcase_30 | AC | 135 ms
22,196 KB |
testcase_31 | AC | 95 ms
18,996 KB |
testcase_32 | AC | 59 ms
15,032 KB |
testcase_33 | AC | 133 ms
22,380 KB |
testcase_34 | AC | 49 ms
13,624 KB |
testcase_35 | AC | 148 ms
22,584 KB |
testcase_36 | AC | 5 ms
8,832 KB |
testcase_37 | AC | 6 ms
8,960 KB |
testcase_38 | AC | 5 ms
8,704 KB |
testcase_39 | AC | 6 ms
8,832 KB |
testcase_40 | AC | 4 ms
8,704 KB |
testcase_41 | AC | 200 ms
23,092 KB |
testcase_42 | AC | 56 ms
12,984 KB |
testcase_43 | AC | 99 ms
16,056 KB |
testcase_44 | AC | 37 ms
11,324 KB |
testcase_45 | AC | 97 ms
15,924 KB |
testcase_46 | AC | 4 ms
8,576 KB |
testcase_47 | AC | 5 ms
8,704 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; #define MOD (long long int)(1e9+7) #define ll long long int #define rep(i,n) for(int i=0; i<(int)(n); i++) #define reps(i,n) for(int i=1; i<=(int)(n); i++) #define REP(i,n) for(int i=n-1; i>=0; i--) #define REPS(i,n) for(int i=n; i>0; i--) #define FOR(i,a,b) for(int i=a; i<(int)(b); i++) #define ALL(x) (x).begin(),(x).end() #define RALL(a) (a).rbegin(), (a).rend() #define CLR(a) memset((a), 0 ,sizeof(a)) #define PB push_back #define MP make_pair #define SP << " " << const int INF = 1001001001; const ll LINF = 100100100100100100; const double EPS = 1e-10; const long double PI = acos(-1.0L); typedef pair<int,int> PII; typedef pair<ll,ll> PLL; typedef pair<double,double> PDD; typedef pair<double,int> PDI; typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<ll> VL; #define chmax(a,b) a = (((a)<(b))?(b):(a)) #define chmin(a,b) a = (((a)>(b))?(b):(a)) __attribute__((constructor)) void initial(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } // queueを用いた場合の実装(経路復元無し) const int MAX_E = 200100; const int MAX_V = 200100; struct edge{int to; double cost;}; int V; vector<edge> G[MAX_V]; double d[MAX_V]; void dijkstra(int s){ // greater<PII>を指定することでfirstが小さい順に取り出せるようにする priority_queue<PDI, vector<PDI>, greater<PDI> > que; fill(d,d+V,(double)INF); d[s] = 0.0; que.push(MP(0.0,s)); while(!que.empty()){ PII p = que.top(); que.pop(); int v = p.second; if(d[v]<p.first) continue; rep(i,G[v].size()){ edge e = G[v][i]; if(d[e.to]>d[v]+e.cost){ d[e.to] = d[v]+e.cost; que.push(PII(d[e.to], e.to)); } } } } signed main(){ int n,m; cin>>n>>m; V=n; int x,y; cin>>x>>y; x--; y--; vector<PDD> t; rep(i,n){ double p,q; cin>>p>>q; t.PB(MP(p,q)); } rep(i,m){ int p,q; cin>>p>>q; p--; q--; double d=pow(pow(t[p].first-t[q].first,2.0)+pow(t[p].second-t[q].second,2.0),0.50); edge e1; e1.to=q; e1.cost=d; G[p].PB(e1); e1.to=p; G[q].PB(e1); } dijkstra(x); cout<<d[y]<<endl; return 0; }