結果

問題 No.1449 新プロランド
ユーザー karinohitokarinohito
提出日時 2021-04-01 14:34:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,629 bytes
コンパイル時間 1,045 ms
コンパイル使用メモリ 113,772 KB
実行使用メモリ 76,972 KB
最終ジャッジ日時 2023-08-25 16:51:34
合計ジャッジ時間 11,940 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 6 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1,901 ms
26,380 KB
testcase_06 AC 513 ms
22,512 KB
testcase_07 AC 205 ms
10,724 KB
testcase_08 AC 642 ms
18,700 KB
testcase_09 AC 125 ms
9,284 KB
testcase_10 AC 592 ms
24,308 KB
testcase_11 AC 94 ms
11,264 KB
testcase_12 AC 701 ms
12,928 KB
testcase_13 AC 52 ms
5,828 KB
testcase_14 AC 43 ms
10,276 KB
testcase_15 AC 374 ms
11,344 KB
testcase_16 AC 111 ms
8,480 KB
testcase_17 AC 500 ms
14,024 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 4 ms
6,736 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 126 ms
10,252 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 82 ms
10,584 KB
testcase_24 AC 57 ms
5,332 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 TLE -
testcase_28 AC 1,396 ms
20,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
	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();
		Q.pop();

		for (auto k : G[p.first]) {
			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;
}
0