結果
問題 | No.1 道のショートカット |
ユーザー | mukadenodaiou |
提出日時 | 2018-03-29 13:42:44 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,676 bytes |
コンパイル時間 | 847 ms |
コンパイル使用メモリ | 98,588 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 05:00:33 |
合計ジャッジ時間 | 1,983 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
ソースコード
# include <iostream> # include <algorithm> # include <vector> # include <string> # include <set> # include <map> # include <cmath> # include <iomanip> # include <functional> # include <utility> # include <stack> # include <queue> # include <list> # include <bitset> # include <complex> #include<limits.h> #include<unordered_map> #include<unordered_set> #include<deque> #include<cstdio> using namespace std; typedef long long int ll; const int N = 1000000; const int INF = 1 << 30; #define rep(i,n) for(int i=(ll)0;i<(ll)n;++i) #define ALL(x) x.begin(),x.end() #define pp pair<ll,ll> #define fi first #define se second string YN(bool b) { return(b ? "YES" : "NO"); } string yn(bool b) { return(b ? "Yes" : "No"); } struct edge { ll to; ll c; ll t; }; ll V, E, money,mn=INF; vector<edge> edges[50]; void dfs(ll pos, ll ti,ll mo,bitset<52>bit2){ cout << pos << "," << ti << "," << mo << "," << bit2 << endl; if (mo >= money)return; if (ti >= mn)return; if (pos == V - 1) { if (mo <= money)mn = min(mn, ti); return; } bitset<52>bit=bit2; bit[pos] = 1; rep(i, (ll)edges[pos].size())if (!bit[edges[pos][i].to]) { dfs(edges[pos][i].to,edges[pos][i].t+ti,edges[pos][i].c+mo,bit); } } int main(){ ll from[1500], to[1500], cost[1500], tm[1500]; cin >> V >> money >> E; rep(i, E)cin >> from[i],from[i]--; rep(i, E)cin >> to[i],to[i]--; rep(i, E)cin >> cost[i]; rep(i, E)cin >> tm[i]; rep(i, E) { //if(from[i]==0||from[i]==20||from[i]==26||from[i]==27)cout << from[i] << "," << to[i] << "," << cost[i] << "," << tm[i] << endl; edges[from[i]].push_back(edge{to[i], cost[i],tm[i]}); } bitset<52>abe; dfs(0, 0, 0, abe); cout << (mn == INF ? -1:mn) << endl; return 0; }