結果
| 問題 |
No.1449 新プロランド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-01 14:36:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,708 bytes |
| コンパイル時間 | 1,731 ms |
| コンパイル使用メモリ | 118,400 KB |
| 実行使用メモリ | 9,984 KB |
| 最終ジャッジ日時 | 2024-12-24 02:02:07 |
| 合計ジャッジ時間 | 2,511 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 7 |
ソースコード
#include <iostream>
//#include<atcoder/all>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
//using namespace atcoder;
using namespace std;
using ll = long long;
#define all(A) A.begin(),A.end()
using vll = vector<ll>;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using Graph = vector<vector<pair<ll, ll>>>;
vector<bool> seen;
bool C = true;
vector<ll> dist;
int main() {
ll N, M;
cin >> N >> M;
seen.assign(N, false);
Graph G(N);
rep(i, M) {
ll A, B, C;
cin >> A >> B >> C;
A--; B--;
G[A].push_back(make_pair(B, C));
G[B].push_back(make_pair(A, C));
}
vll T(N);
rep(i, N)cin >> T[i];
vector<vll> dist(N, vll(N * 105, 1e18));
priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> Q;
dist[0][T[0]] = T[0];
Q.push(make_pair(0, T[0]));
while (!Q.empty()) {
auto p = Q.top();
seen[p.first] = true;
Q.pop();
for (auto k : G[p.first]) {
if (seen[k.first])continue;
if (p.second + T[k.first] >= N * 101)continue;
if (dist[k.first][p.second + T[k.first]] > dist[p.first][p.second] + k.second / p.second + T[k.first]) {
dist[k.first][p.second + T[k.first]] = dist[p.first][p.second] + k.second / p.second + T[k.first];
Q.push(make_pair(k.first, p.second + T[k.first]));
}
}
}
ll an = 1e18;
rep(t, N * 101) {
an = min(an, dist[N - 1][t]);
}
cout << an << endl;
}