結果
| 問題 | No.3616 WK vs AT vs MT vs SP |
| コンテスト | |
| ユーザー |
ococonomy1
|
| 提出日時 | 2026-08-06 14:25:38 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 6,571 bytes |
| 記録 | |
| コンパイル時間 | 1,623 ms |
| コンパイル使用メモリ | 229,608 KB |
| 実行使用メモリ | 83,116 KB |
| 最終ジャッジ日時 | 2026-08-06 14:25:47 |
| 合計ジャッジ時間 | 7,416 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 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 * 35 WA * 1 |
| 合計 | 2.5 * 84% = 210 点 |
ソースコード
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pli = pair<ll,int>;
#define MOD 998244353
//#define MOD 1000000007
#define el '\n'
#define El '\n'
#define YESNO(x) ((x) ? "Yes" : "No")
#define YES YESNO(true)
#define NO YESNO(false)
#define EXIT_ANS(x) {cout << (x) << '\n'; return;}
template <typename T> void inline SORT(T &v){sort(v.begin(),v.end()); return;}
template <typename T> void inline REV(T &v){reverse(v.begin(),v.end()); return;}
template <typename T> void inline VEC_UNIQ(T &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); return;}
template <typename T> auto inline MAX(T &v){return *max_element(v.begin(),v.end());}
template <typename T> auto inline MIN(T &v){return *min_element(v.begin(),v.end());}
template <typename T> auto inline SUM(vector<T> &v){T ans = 0; for(int i = 0; i < (int)v.size(); i++)ans += v[i]; return ans;}
template <typename T> void inline DEC(T &v){for(int i = 0; i < (int)v.size(); i++)v[i]--; return;}
template <typename T> void inline INC(T &v){for(int i = 0; i < (int)v.size(); i++)v[i]++; return;}
void inline TEST(void){cerr << "TEST" << endl; return;}
template <typename T,typename S> bool inline chmin(T &x,S y){
if(x > (T)y){
x = (T)y;
return true;
}
return false;
}
template <typename T,typename S> bool inline chmax(T &x,S y){
if(x < (T)y){
x = (T)y;
return true;
}
return false;
}
template <typename T = long long> vector<T> inline get_vec(int n){
vector<T> ans(n);
for(int i = 0; i < n; i++)cin >> ans[i];
return ans;
}
template <typename T> void inline print_vec(vector<T> &vec,bool kaigyou = false){
int n = (int)vec.size();
for(int i = 0; i < n; i++){
cout << vec[i];
if(kaigyou || i == n - 1)cout << '\n';
else cout << ' ';
}
if(!n)cout << '\n';
return;
}
template <typename T> void inline debug_vec(vector<T> &vec,bool kaigyou = false){
int n = (int)vec.size();
for(int i = 0; i < n; i++){
cerr << vec[i];
if(kaigyou || i == n - 1)cerr << '\n';
else cerr << ' ';
}
if(!n)cerr << '\n';
return;
}
vector<vector<int>> inline get_graph(int n,int m = -1,bool direct = false,bool decrement = true){
if(m == -1)m = n - 1;
vector<vector<int>> g(n);
while(m--){
int u,v;
cin >> u >> v;
if(decrement)u--,v--;
g[u].push_back(v);
if(!direct)g[v].push_back(u);
}
return g;
}
template <typename T> vector<vector<pair<T,int>>> inline get_weighted_graph(int n,int m = -1,bool direct = false,bool decrement = true){
if(m == -1)m = n - 1;
vector<vector<pair<T,int>>> g(n);
while(m--){
int u,v;
cin >> u >> v;
if(decrement)u--,v--;
ll w; cin >> w;
g[u].push_back(pair(w,v));
if(!direct)g[v].push_back(pair(w,u));
}
return g;
}
// ダイクストラ
// 引数はグラフのvectorと始点となるノード
// {他のノードへの距離を入れたvector,経路復元において1個前はどこに戻るか}を返す関数
// s→始点となるノード
template <typename T,T inf>
pair<vector<T>, vector<int>> ococo_dijkstra(vector<vector<pair<T, int>>> const &g, int s) {
int n = (int)g.size();
vector<T> distance(n, inf);
priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> que;
que.emplace(0, s);
vector<bool> visited(n, false);
distance[s] = 0;
vector<int> par(n, -1);
par[s] = s;
while(!que.empty()) {
int fr = que.top().second; que.pop();
if(!visited[fr]) {
for(int i = 0; i < (int)g[fr].size(); i++) {
int to; ll w;
tie(w,to) = g[fr][i];
if(distance[to] > distance[fr] + w){
distance[to] = distance[fr] + w;
que.emplace(distance[to],to);
par[to] = fr;
}
}
}
visited[fr] = true;
}
return pair(distance,par);
}
#define MULTI_TEST_CASE false
void solve(void){
//問題を見たらまず「この問題設定から言えること」をいっぱい言う
//よりシンプルな問題に言い換えられたら、言い換えた先の問題を自然言語ではっきりと書く
//複数の解法のアイデアを思いついた時は全部メモしておく
//g++ -D_GLIBCXX_DEBUG -Wall -O2 h.cpp -o o
int n,r;
cin >> n >> r;
ll c; cin >> c;
vector<vector<pli>> g(8 * n + 1);
//x auto y manu z fune
vector<ll> x = get_vec(n);
vector<ll> y = get_vec(n);
vector<ll> z = get_vec(n);
vector<ll> s = get_vec(n);
for(int i = 0; i < n; i++){
int idx = i * 8;
for(int j = 0; j < 8; j++){
if((j & 1) == 0)g[idx + j].push_back(pair(x[i],idx + j + 1));
if((j & 2) == 0)g[idx + j].push_back(pair(y[i],idx + j + 2));
if((j & 4) == 0)g[idx + j].push_back(pair(z[i],idx + j + 4));
if(j & 4){
g[idx + j].push_back(pair(s[i] + c,8 * n));
g[8 * n].push_back(pair(s[i],idx + j));
}
}
}
while(r--){
int u,v;
cin >> u >> v;
u--; v--;
ll w,a,m;
cin >> w >> a >> m;
//walk,auto,man
int idx = u * 8,jdx = v * 8;
for(int j = 0; j < 8; j++){
g[idx + j].push_back(pair(w,jdx + j));
g[jdx + j].push_back(pair(w,idx + j));
if((j & 1) != 0 || (j & 2) != 0){
g[idx + j].push_back(pair(a,jdx + j));
g[jdx + j].push_back(pair(a,idx + j));
}
if(j & 2){
g[jdx + j].push_back(pair(m,idx + j));
g[idx + j].push_back(pair(m,jdx + j));
}
}
}
auto dist = ococo_dijkstra<ll,LLONG_MAX / 2>(g,0);
ll ans = LLONG_MAX;
// for(int i = 0; i < n; i++){
// for(int j = 0; j < 8; j++){
// cerr << dist.first[i * 8 + j] << ' ';
// }
// cerr << el;
// }
for(int i = 0; i < 8; i++)chmin(ans,dist.first[(n - 1) * 8 + i]);
cout << ans << el;
return;
}
void calc(void){
return;
}
signed main(void){
cin.tie(nullptr);
ios::sync_with_stdio(false);
calc();
int t = 1;
if(MULTI_TEST_CASE)cin >> t;
while(t--){
solve();
}
return 0;
}
ococonomy1