結果

問題 No.1449 新プロランド
ユーザー 蜜蜂蜜蜂
提出日時 2021-04-01 16:32:22
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,390 bytes
コンパイル時間 4,016 ms
コンパイル使用メモリ 241,060 KB
実行使用メモリ 92,640 KB
最終ジャッジ日時 2023-08-25 16:51:36
合計ジャッジ時間 8,103 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
21,764 KB
testcase_01 AC 33 ms
22,784 KB
testcase_02 AC 489 ms
56,396 KB
testcase_03 AC 18 ms
21,944 KB
testcase_04 AC 22 ms
22,024 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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--)

vvll dp(110,vll(21000,1e18));
using T = tuple<int,int,ll>;

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>20000)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]]});
      }
    }
  }

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

  cout<<ans<<endl;
}
0