結果
| 問題 |
No.1 道のショートカット
|
| コンテスト | |
| ユーザー |
tea_pt
|
| 提出日時 | 2015-05-01 16:02:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,108 bytes |
| コンパイル時間 | 782 ms |
| コンパイル使用メモリ | 82,584 KB |
| 最終ジャッジ日時 | 2024-11-14 19:02:46 |
| 合計ジャッジ時間 | 1,417 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:39:26: error: narrowing conversion of ‘-1.1000000000000001e+0’ from ‘double’ to ‘long long int’ [-Wnarrowing]
39 | int dx[4] = { -1.1, 0, 0 };
| ^
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>
#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPA(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#if defined(_MSC_VER)||__cplusplus > 199711L
#define AUTO(r,v) auto r = (v)
#else
#define AUTO(r,v) typeof(v) r = (v)
#endif
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it)
#define LL long long
#define int LL
#define INF 99999999
#define DEV 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
int dx[4] = { -1.1, 0, 0 };
int dy[4] = { 0, 0, 1, -1 };
int S[1600], T[1600], Y[1600], M[1600];
int N, C, V;
struct edge{
int from,to, cost, mo;
};
bool operator<(const edge& le, const edge& ri){ return le.mo < ri.mo; }
bool operator>(const edge& le, const edge& ri){ return le.mo > ri.mo; }
vector<edge> g[60];
int ed[60];
signed main()
{
QUICK_CIN;
//ifstream cin("debug.txt");
//ofstream cout("result.txt");
cin >> N >> C >> V;
REP(i, V){
cin >> S[i];
S[i]--;
}
REP(i, V){
cin >> T[i];
T[i]--;
}
REP(i, V){
cin >> Y[i];
}
REP(i, V){
cin >> M[i];
}
REP(i, V){
edge temp{S[i], T[i], Y[i], M[i] };
g[S[i]].push_back(temp);
}
fill(ed, ed + 60, INF);
queue<edge> q;
for (auto x : g[0]){
edge st{ 0, x.to, x.cost, x.mo };
q.push(st);
ed[x.to] = x.mo;
}
ed[0] = 0;
while (!q.empty()){
auto now = q.front();
q.pop();
for (auto x : g[now.to]){
if (now.cost + x.cost > C){
continue;
}
if (now.mo + x.mo <= ed[x.to]){
edge temp{x.from,x.to,now.cost+x.cost,now.mo+x.mo};
q.push(temp);
ed[x.to] = now.mo + x.mo;
}
}
}
if (ed[N - 1] != INF){
cout << ed[N - 1] << endl;
return 0;
}
cout << -1 << endl;
return 0;
}
tea_pt