結果
問題 | No.1599 Hikyaku |
ユーザー | butsurizuki |
提出日時 | 2021-05-04 03:45:37 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,278 bytes |
コンパイル時間 | 2,259 ms |
コンパイル使用メモリ | 210,492 KB |
実行使用メモリ | 63,324 KB |
最終ジャッジ日時 | 2023-09-14 06:45:59 |
合計ジャッジ時間 | 38,306 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
52,728 KB |
testcase_01 | AC | 279 ms
58,960 KB |
testcase_02 | AC | 365 ms
57,884 KB |
testcase_03 | AC | 15 ms
52,912 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 1,464 ms
62,384 KB |
testcase_08 | AC | 1,393 ms
62,472 KB |
testcase_09 | AC | 1,412 ms
57,364 KB |
testcase_10 | AC | 1,475 ms
53,268 KB |
testcase_11 | AC | 1,176 ms
53,032 KB |
testcase_12 | AC | 439 ms
53,036 KB |
testcase_13 | AC | 464 ms
52,960 KB |
testcase_14 | AC | 48 ms
52,760 KB |
testcase_15 | AC | 98 ms
52,736 KB |
testcase_16 | AC | 15 ms
52,732 KB |
testcase_17 | WA | - |
testcase_18 | AC | 244 ms
55,668 KB |
testcase_19 | AC | 1,755 ms
62,060 KB |
testcase_20 | AC | 1,755 ms
62,892 KB |
testcase_21 | AC | 1,751 ms
54,484 KB |
testcase_22 | AC | 1,750 ms
54,468 KB |
testcase_23 | AC | 1,762 ms
53,452 KB |
testcase_24 | AC | 1,788 ms
53,252 KB |
testcase_25 | AC | 1,748 ms
52,864 KB |
testcase_26 | AC | 1,488 ms
52,864 KB |
testcase_27 | AC | 828 ms
52,888 KB |
testcase_28 | AC | 825 ms
52,976 KB |
testcase_29 | AC | 606 ms
53,088 KB |
testcase_30 | AC | 298 ms
53,028 KB |
testcase_31 | AC | 109 ms
52,744 KB |
testcase_32 | AC | 62 ms
52,872 KB |
testcase_33 | AC | 151 ms
52,904 KB |
testcase_34 | AC | 333 ms
52,828 KB |
testcase_35 | AC | 567 ms
52,856 KB |
testcase_36 | AC | 836 ms
53,104 KB |
testcase_37 | AC | 820 ms
52,908 KB |
testcase_38 | AC | 805 ms
52,900 KB |
testcase_39 | AC | 812 ms
53,856 KB |
testcase_40 | AC | 860 ms
55,472 KB |
testcase_41 | AC | 15 ms
52,928 KB |
testcase_42 | AC | 88 ms
52,924 KB |
testcase_43 | AC | 101 ms
52,872 KB |
testcase_44 | WA | - |
testcase_45 | AC | 20 ms
52,988 KB |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | AC | 15 ms
52,928 KB |
testcase_50 | AC | 15 ms
52,848 KB |
testcase_51 | AC | 16 ms
52,724 KB |
testcase_52 | AC | 428 ms
53,020 KB |
ソースコード
#include<bits/stdc++.h> const double eps=1.0e-9; using namespace std; using pi=pair<int,int>; using pdpi=pair<double,pi>; int main(){ int x,y; cin >> x >> y; x--;y--; int rd=x*600+y; int n; cin >> n; vector<int> sx(n),sy(n),sv(n); double dp[393939][16]; for(int i=0;i<393939;i++){ for(int j=0;j<16;j++){ dp[i][j]=1.0e9; } } double len[32]; for(int i=1;i<32;i++){len[i]=1000.0/((double)i);} priority_queue<pdpi,vector<pdpi>,greater<pdpi>> pq; for(int i=0;i<n;i++){ cin >> sx[i] >> sy[i] >> sv[i]; sx[i]--;sy[i]--; if(i){ dp[sx[i]*600+sy[i]][sv[i]]=0.0; pq.push({0.0,{sx[i]*600+sy[i],sv[i]}}); } else{ dp[sx[i]*600+sy[i]][7+sv[i]]=0.0; pq.push({0.0,{sx[i]*600+sy[i],7+sv[i]}}); } } while(!pq.empty()){ pdpi od=pq.top();pq.pop(); int vp=od.second.first; int vt=od.second.second; if(dp[vp][vt]<od.first){continue;} //cout << od.first << ':'; //cout << vp << ' '; //cout << vt << '\n'; if(od.second.first==rd && vt>=8){ printf("%.12lf\n",od.first); return 0; } vector<int> kh; if(vp%600!=0){kh.push_back(vp-1);} if(vp%600!=599){kh.push_back(vp+1);} if((vp-600)>=0){kh.push_back(vp-600);} if((vp+600)<360000){kh.push_back(vp+600);} if(vt<=7){ for(auto &nx : kh){ if(dp[nx][vt]>od.first+len[vt]){ dp[nx][vt]=od.first+len[vt]; pq.push({od.first+len[vt],{nx,vt}}); } for(int i=8;i<=14;i++){ if(i-7>=vt){continue;} if(dp[nx][i]>od.first+eps){continue;} int nv=7+max(vt,i-7); if(dp[nx][i]+len[i-7]+eps>=od.first){ double reml=max(0.0,1000.0-(od.first-dp[nx][i])*(i-7.0)); double kgl=reml*vt/(i+vt-7.0); double kgt=reml/(i+vt-7.0); //cout << reml << ' ' << kgl << ',' << kgt << '\n'; int tg=vp; double nt=od.first+2.0*kgt; if(dp[tg][nv]>nt){ dp[tg][nv]=nt; pq.push({nt,{tg,nv}}); } tg=nx; nt=od.first+kgt+(1000.0-kgl)/(nv-7.0); if(dp[tg][nv]>nt){ dp[tg][nv]=nt; pq.push({nt,{tg,nv}}); } } } } } else{ for(auto &nx : kh){ if(dp[nx][vt]>od.first+len[vt-7]){ dp[nx][vt]=od.first+len[vt-7]; pq.push({od.first+len[vt-7],{nx,vt}}); } for(int i=1;i<=7;i++){ if(vt-7>=i){continue;} if(dp[nx][i]>od.first+eps){continue;} int nv=7+max(vt-7,i); if(dp[nx][i]+len[i]+eps>=od.first){ double reml=max(0.0,1000.0-(od.first-dp[nx][i])*((double)i)); double kgl=reml*(vt-7.0)/(i+vt-7.0); double kgt=reml/(i+vt-7.0); //cout << reml << ' ' << kgl << '@' << kgt << '\n'; int tg=vp; double nt=od.first+2.0*kgt; if(dp[tg][nv]>nt){ dp[tg][nv]=nt; pq.push({nt,{tg,nv}}); } tg=nx; nt=od.first+kgt+(1000.0-kgl)/(nv-7.0); if(dp[tg][nv]>nt){ dp[tg][nv]=nt; pq.push({nt,{tg,nv}}); } } } } } } return 0; }