結果
| 問題 | No.3616 WK vs AT vs MT vs SP |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-14 15:12:11 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,754 bytes |
| 記録 | |
| コンパイル時間 | 4,677 ms |
| コンパイル使用メモリ | 393,480 KB |
| 実行使用メモリ | 53,336 KB |
| 最終ジャッジ日時 | 2026-08-14 15:12:23 |
| 合計ジャッジ時間 | 10,225 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | AC * 1 |
| 小課題1 | 8 % | AC * 8 WA * 1 |
| 小課題2 | 16 % | AC * 5 |
| 小課題3 | 20 % | AC * 10 |
| 小課題4 | 20 % | AC * 12 WA * 3 |
| 小課題5 | 20 % | AC * 15 |
| 小課題6 | 16 % | AC * 26 WA * 10 |
| 合計 | 2.5 * 56% = 140 点 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, x, limit) for (long long i = (long long)x; i < (long long)limit; i++)
#define REP(i, x, limit) for (long long i = (long long)x; i <= (long long)limit; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define el '\n'
#define spa " "
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define YES cout << "YES" << el
#define NO cout << "NO" << el
#define inp(x) for(auto &i:x)cin>>i
#define eps (1e-10)
#define Equals(a,b) (fabs((a) - (b)) < eps )
#define debug(x) cerr << #x << " = " << x << el
using ll = long long;
using ull = unsigned long long;
using i128 = __int128_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;
using vb = vector<bool>;
const double pi = 3.141592653589793238;
const int inf = 1073741823;
const ll infl = 1LL << 60;
const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string abc = "abcdefghijklmnopqrstuvwxyz";
const ll MOD = 998244353;
#include<atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using vm = vector<mint>;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
//w,a,m,w+s,a+s,m+s
ll n,r,c;cin>>n>>r>>c;
vl X(n),Y(n),Z(n),S(n);inp(X);inp(Y);inp(Z);inp(S);
vector<vector<pll>> G1(n*6),G2(n*6);
rep(i,0,r){
ll u,v,w,a,m;cin>>u>>v>>w>>a>>m;
u--;v--;
G1[u].push_back({v,w});
G1[v].push_back({u,w});
G1[u+n].push_back({v+n,a});
G1[v+n].push_back({u+n,a});
G1[u+n*2].push_back({v+n*2,m});
G1[v+n*2].push_back({u+n*2,m});
G1[v+n*3].push_back({u+n*3,w});
G1[u+n*3].push_back({v+n*3,w});
G2[u+n*3].push_back({v+n*3,w});
G2[v+n*3].push_back({u+n*3,w});
G1[v+n*4].push_back({u+n*4,a});
G1[u+n*4].push_back({v+n*4,a});
G2[u+n*4].push_back({v+n*4,a});
G2[v+n*4].push_back({u+n*4,a});
G1[v+n*5].push_back({u+n*5,m});
G1[u+n*5].push_back({v+n*5,m});
G2[u+n*5].push_back({v+n*5,m});
G2[v+n*5].push_back({u+n*5,m});
}
rep(i,0,n){
G1[i].push_back({i+n,X[i]});
G1[i+n*3].push_back({i+n*4,X[i]});
G2[i+n*4].push_back({i+n*3,X[i]});
G1[i].push_back({i+n*2,Y[i]});
G1[i+n*3].push_back({i+n*5,Y[i]});
G1[i+n*4].push_back({i+n*5,Y[i]});
G2[i+n*5].push_back({i+n*3,Y[i]});
G2[i+n*5].push_back({i+n*4,Y[i]});
G1[i+n].push_back({i+n*2,Y[i]});
G1[i].push_back({i+n*3,Z[i]});
G1[i+n].push_back({i+n*4,Z[i]});
G1[i+n*2].push_back({i+n*5,Z[i]});
}
vl dist(n*6,infl),dist2(n*6,infl);
priority_queue<pll,vector<pll>,greater<pll>> pq;
pq.push({0,0});
dist[0]=0;
while(!pq.empty()){
auto [d,v]=pq.top();pq.pop();
if(dist[v]<d)continue;
for(auto [to,cost]:G1[v]){
if(dist[to]>dist[v]+cost){
dist[to]=dist[v]+cost;
pq.push({dist[to],to});
}
}
}
dist2[n*6-1]=0;
dist2[n*5-1]=0;
dist2[n*4-1]=0;
pq.push({0,n*6-1});
pq.push({0,n*5-1});
pq.push({0,n*4-1});
while(!pq.empty()){
auto [d,v]=pq.top();pq.pop();
if(dist2[v]<d)continue;
for(auto [to,cost]:G2[v]){
if(dist2[to]>dist2[v]+cost){
dist2[to]=dist2[v]+cost;
pq.push({dist2[to],to});
}
}
}
rep(i,0,n){
rep(j,0,3){
dist[i+n*(j+3)]+=S[i];
dist2[i+n*(j+3)]+=S[i];
}
}
ll ans=infl;
rep(i,0,3){
ans=min(ans,dist[n*(i+1)-1]);
}
rep(i,0,3){
ll stc=c;
stc+=*min_element(dist.begin()+n*(i+3),dist.begin()+n*(i+4))+*min_element(dist2.begin()+n*(i+3),dist2.begin()+n*(i+4));
ans=min(ans,stc);
}
cout<<ans<<el;
}