結果

問題 No.1449 新プロランド
ユーザー chocoruskchocorusk
提出日時 2021-03-31 23:00:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,666 bytes
コンパイル時間 3,524 ms
コンパイル使用メモリ 193,800 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 16:51:11
合計ジャッジ時間 4,895 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 14 ms
4,380 KB
testcase_06 AC 10 ms
4,380 KB
testcase_07 AC 5 ms
4,376 KB
testcase_08 AC 10 ms
4,380 KB
testcase_09 AC 7 ms
4,376 KB
testcase_10 AC 5 ms
4,380 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 9 ms
4,376 KB
testcase_13 AC 7 ms
4,380 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 11 ms
4,380 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 8 ms
4,376 KB
testcase_18 AC 2 ms
4,384 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 5 ms
4,380 KB
testcase_24 AC 5 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 15 ms
4,380 KB
testcase_28 AC 9 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    int n, m;
    cin>>n>>m;
    int t[101];
    vector<P> g[101];
    for(int i=0; i<m; i++){
        int a, b, c;
        cin>>a>>b>>c; a--; b--;
        g[a].push_back({b, c});
        g[b].push_back({a, c});
    }
    for(int i=0; i<n; i++) cin>>t[i];
    int dp[101][1010];
    const int INF=1e9+7;
    for(int i=0; i<n; i++){
        fill(dp[i], dp[i]+1001, INF);
    }
    dp[0][0]=0;
    using Pi=pair<int, P>;
    priority_queue<Pi, vector<Pi>, greater<Pi>> que;
    que.push({0, {0, 0}});
    while(!que.empty()){
        auto p=que.top();
        que.pop();
        int x=p.second.first, s=p.second.second;
        if(dp[x][s]<p.first) continue;
        int s1=min(1000, s+t[x]);
        for(auto q:g[x]){
            int y=q.first;
            int c=q.second;
            if(dp[y][s1]>dp[x][s]+c/s1+t[x]){
                dp[y][s1]=dp[x][s]+c/s1+t[x];
                que.push({dp[y][s1], {y, s1}});
            }
        }
    }
    int ans=INF;
    for(int i=0; i<=1000; i++) ans=min(ans, dp[n-1][i]);
    cout<<ans<<endl;
    return 0;
}
0