結果
| 問題 | No.3616 WK vs AT vs MT vs SP |
| コンテスト | |
| ユーザー |
KEYBO
|
| 提出日時 | 2026-08-06 15:38:04 |
| 言語 | C++23(gnu拡張gcc16) (gcc 16.1.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 567 ms / 2,000 ms |
| + 582µs | |
| コード長 | 2,236 bytes |
| 記録 | |
| コンパイル時間 | 6,906 ms |
| コンパイル使用メモリ | 405,236 KB |
| 実行使用メモリ | 95,716 KB |
| 最終ジャッジ日時 | 2026-08-06 15:38:22 |
| 合計ジャッジ時間 | 16,364 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | AC * 1 |
| 小課題1 | 8 % | AC * 9 |
| 小課題2 | 16 % | AC * 5 |
| 小課題3 | 20 % | AC * 10 |
| 小課題4 | 20 % | AC * 15 |
| 小課題5 | 20 % | AC * 15 |
| 小課題6 | 16 % | AC * 36 |
| 合計 | 2.5 * 100% = 250 点 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll = int64_t;
using ul = uint64_t;
using ld = long double;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvd = vector<vd>;
using vvc = vector<vc>;
using vvb = vector<vb>;
using vvl = vector<vl>;
using mint = modint998244353;
using vm = vector<mint>;
int main() {
ll N,R,C;
cin >> N >> R >> C;
vector<vector<vvl>> G(N + 1, vector<vvl>(6));
vl X(N),Y(N),Z(N),S(N);
for (int i = 0; i < N; i++) {
cin >> X[i];
G[i][0].push_back({i, 1, X[i]});
G[i][3].push_back({i, 4, X[i]});
}
for (int i = 0; i < N; i++) {
cin >> Y[i];
for (int j = 0; j < 2; j++) {
G[i][j].push_back({i, 2, Y[i]});
G[i][j + 3].push_back({i, 5, Y[i]});
}
}
for (int i = 0; i < N; i++) {
cin >> Z[i];
for (int j = 0; j < 3; j++) {
G[i][j].push_back({i, j + 3, Z[i]});
}
}
for (int i = 0; i < N; i++) {
cin >> S[i];
for (int j = 3; j < 6; j++) {
G[i][j].push_back({N, j, S[i] + C});
G[N][j].push_back({i, j, S[i]});
}
}
for (int i = 0; i < R; i++) {
int u,v;
ll W,A,M;
cin >> u >> v >> W >> A >> M;
vl mod3(3, 1e18);
mod3[0] = W;
mod3[1] = min(W, A);
mod3[2] = min(W, min(A, M));
u--,v--;
for (int j = 0; j < 6; j++) {
G[u][j].push_back({v, j, mod3[j%3]});
G[v][j].push_back({u, j, mod3[j%3]});
}
}
vvb abso(N + 1, vb(6, false));
vvl dist(N + 1, vl(6, 1e18));
priority_queue<vl, vvl, greater<vl>> pq;
dist[0][0] = 0;
pq.push({0, 0, 0});
while(!pq.empty()) {
int now = pq.top()[1],lic = pq.top()[2];
pq.pop();
if (abso[now][lic]) continue;
abso[now][lic] = true;
for (auto nv : G[now][lic]) {
int next = nv[0],nlic = nv[1];
ll cost = nv[2];
if (dist[next][nlic] <= dist[now][lic] + cost) continue;
dist[next][nlic] = dist[now][lic] + cost;
pq.push({dist[next][nlic], next, nlic});
}
}
ll ans = 1e18;
for (int i = 0; i < 6; i++) {
ans = min(ans, dist[N - 1][i]);
}
cout << ans << endl;
return 0;
}
KEYBO