結果
問題 | No.1449 新プロランド |
ユーザー | 蜜蜂 |
提出日時 | 2021-04-01 16:42:44 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 331 ms / 2,000 ms |
コード長 | 1,434 bytes |
コンパイル時間 | 4,156 ms |
コンパイル使用メモリ | 239,648 KB |
実行使用メモリ | 10,152 KB |
最終ジャッジ日時 | 2023-08-25 16:51:59 |
合計ジャッジ時間 | 6,255 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,384 KB |
testcase_01 | AC | 3 ms
4,380 KB |
testcase_02 | AC | 17 ms
4,388 KB |
testcase_03 | AC | 2 ms
4,384 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 105 ms
5,376 KB |
testcase_06 | AC | 36 ms
4,652 KB |
testcase_07 | AC | 20 ms
4,380 KB |
testcase_08 | AC | 31 ms
4,384 KB |
testcase_09 | AC | 63 ms
5,380 KB |
testcase_10 | AC | 36 ms
4,584 KB |
testcase_11 | AC | 9 ms
4,384 KB |
testcase_12 | AC | 32 ms
4,380 KB |
testcase_13 | AC | 18 ms
4,384 KB |
testcase_14 | AC | 4 ms
4,380 KB |
testcase_15 | AC | 34 ms
4,384 KB |
testcase_16 | AC | 19 ms
4,380 KB |
testcase_17 | AC | 46 ms
4,816 KB |
testcase_18 | AC | 2 ms
4,380 KB |
testcase_19 | AC | 2 ms
4,384 KB |
testcase_20 | AC | 2 ms
4,380 KB |
testcase_21 | AC | 10 ms
4,384 KB |
testcase_22 | AC | 7 ms
4,380 KB |
testcase_23 | AC | 8 ms
4,384 KB |
testcase_24 | AC | 32 ms
5,380 KB |
testcase_25 | AC | 2 ms
4,384 KB |
testcase_26 | AC | 3 ms
4,380 KB |
testcase_27 | AC | 88 ms
5,400 KB |
testcase_28 | AC | 331 ms
10,152 KB |
コンパイルメッセージ
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]){ | ^
ソースコード
//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(1200,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])continue; for(auto[next,len]:g[now]){ if(dp[next][min(1100,now2+t[now])]>time+t[now]+len/(min(1100,now2+t[now]))){ dp[next][min(1100,now2+t[now])]=time+t[now]+len/(min(1100,now2+t[now])); que.push({next,min(1100,now2+t[now]),dp[next][min(1100,now2+t[now])]}); } } } int ans=1e9; rep(i,0,1100){ ans=min(ans,dp[n-1][i]); } cout<<ans<<endl; }