結果
| 問題 | No.1449 新プロランド |
| コンテスト | |
| ユーザー |
蜜蜂
|
| 提出日時 | 2021-04-01 16:42:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 358 ms / 2,000 ms |
| コード長 | 1,434 bytes |
| 記録 | |
| コンパイル時間 | 4,730 ms |
| コンパイル使用メモリ | 240,516 KB |
| 実行使用メモリ | 10,096 KB |
| 最終ジャッジ日時 | 2024-12-24 02:04:14 |
| 合計ジャッジ時間 | 6,622 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:55:9: warning: 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: warning: 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;
}
蜜蜂