結果

問題 No.1449 新プロランド
ユーザー 蜜蜂蜜蜂
提出日時 2021-04-01 16:38:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,388 bytes
コンパイル時間 4,152 ms
コンパイル使用メモリ 239,376 KB
実行使用メモリ 62,632 KB
最終ジャッジ日時 2023-08-25 16:51:57
合計ジャッジ時間 19,932 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
8,564 KB
testcase_01 AC 14 ms
8,940 KB
testcase_02 AC 201 ms
20,968 KB
testcase_03 AC 7 ms
8,860 KB
testcase_04 AC 8 ms
8,956 KB
testcase_05 AC 1,905 ms
33,572 KB
testcase_06 AC 934 ms
32,908 KB
testcase_07 AC 281 ms
11,496 KB
testcase_08 AC 614 ms
15,428 KB
testcase_09 AC 583 ms
21,884 KB
testcase_10 AC 730 ms
21,448 KB
testcase_11 AC 95 ms
10,044 KB
testcase_12 AC 826 ms
16,024 KB
testcase_13 AC 177 ms
14,928 KB
testcase_14 AC 40 ms
9,152 KB
testcase_15 AC 538 ms
14,788 KB
testcase_16 AC 364 ms
20,840 KB
testcase_17 AC 867 ms
20,656 KB
testcase_18 AC 6 ms
8,612 KB
testcase_19 AC 5 ms
8,604 KB
testcase_20 AC 6 ms
8,608 KB
testcase_21 AC 201 ms
15,772 KB
testcase_22 AC 137 ms
9,992 KB
testcase_23 AC 89 ms
9,904 KB
testcase_24 AC 668 ms
33,328 KB
testcase_25 AC 16 ms
8,756 KB
testcase_26 AC 9 ms
8,768 KB
testcase_27 TLE -
testcase_28 TLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:55:9: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   55 |     auto[now,now2,time]=que.top();
      |         ^
main.cpp:60:13: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   60 |     for(auto[next,len]:g[now]){
      |             ^

ソースコード

diff #

//g++ 2.cpp -std=c++14 -I .
#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;

#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)

vvi dp(110,vi(12000,1e9));
using T = tuple<int,int,int>;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n,m;
  cin>>n>>m;

  vector<vector<pair<int,int>>> g(n);
  rep(i,0,m){
    int a,b,c;
    cin>>a>>b>>c;
    a--;b--;
    g[a].pb({b,c});
    g[b].pb({a,c});
  }

  vi t(n);
  rep(i,0,n){
    cin>>t[i];
  }

  dp[0][0]=0;

  priority_queue<T,vector<T>,greater<T>> que;
  que.push({0,0,0});

  while(!que.empty()){
    auto[now,now2,time]=que.top();
    que.pop();

    if(time>dp[now][now2]||time>10000)continue;

    for(auto[next,len]:g[now]){
      if(dp[next][now2+t[now]]>time+t[now]+len/(now2+t[now])){
        dp[next][now2+t[now]]=time+t[now]+len/(now2+t[now]);
        que.push({next,now2+t[now],dp[next][now2+t[now]]});
      }
    }
  }

  int ans=1e9;
  rep(i,0,11000){
    ans=min(ans,dp[n-1][i]);
  }

  cout<<ans<<endl;
}
0