結果
問題 | No.1283 Extra Fee |
ユーザー |
![]() |
提出日時 | 2020-11-07 22:33:32 |
言語 | cLay (20241019-1) |
結果 |
AC
|
実行時間 | 244 ms / 2,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 3,555 ms |
コンパイル使用メモリ | 179,604 KB |
実行使用メモリ | 108,416 KB |
最終ジャッジ日時 | 2024-11-16 07:07:09 |
合計ジャッジ時間 | 8,134 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
int n,m,a[6d6],b[6d6],k;ll cost[501][501],c[6d6],dist[5d5];int to_i(int x,int y,int f){return (y*n+x)*2+f;}{rd(n,m);rep(i,m){ll@h,@w,@c;cost[h-1][w-1]=c;}VI d{1,0,-1,0,1};rep(i,n)rep(j,n)rep(_,4){int y=i+d[_],x=j+d[_+1];if(0<=x<n&&0<=y<n){a[k]=to_i(j,i,0);b[k]=to_i(x,y,0);c[k]=cost[y][x]+1;k++;a[k]=to_i(j,i,0);b[k]=to_i(x,y,1);c[k]=1;k++;a[k]=to_i(j,i,1);b[k]=to_i(x,y,1);c[k]=cost[y][x]+1;k++;}}wgraph<ll>g;g.setDirectEdge(5d5,k,a,b,c);g.getDist(0,dist);wt(dist[to_i(n-1,n-1,1)]);}