AtCoder Beginner Contest 204
問題文
省略
省略
C++に変換後のコードはこちら
int N, M, A[1d5], B[]; ll C[], D[];
wgraph<ll> g, g2;
{
int i, j, s; ll c;
DijkstraHeap<ll> hp;
rd(N,M,(A--,B--,C,D)(M));
g.setEdge(N,M,A,B,C);
g2.setEdge(N,M,A,B,D);
hp.walloc(N,1);
hp.change(0,0);
while(hp.size){
i = hp.pop();
c = hp.val[i];
if(i==N-1) wt(c), return 0;
rep(j,g.es[i]){
s = max(Isqrt(g2.cost[i][j]) - c - 2, 0);
hp.change(g.edge[i][j], c + g.cost[i][j] + min[x,s,s+4](x + g2.cost[i][j] / (c+x+1)));
}
}
wt(-1);
}
Current time: 2024年04月24日12時23分55秒
Last modified: 2021年06月07日19時39分51秒 (by laycrs)
Tags: Competitive_Programming_Incomplete AtCoder AtCoder_Beginner_Contest ABC204 ABC_E
トップページに戻る
Logged in as: unknown user (not login)