結果
問題 | No.1812 Uribo Road |
ユーザー | 沙耶花 |
提出日時 | 2022-01-14 22:04:47 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,125 bytes |
コンパイル時間 | 4,664 ms |
コンパイル使用メモリ | 269,436 KB |
実行使用メモリ | 174,136 KB |
最終ジャッジ日時 | 2024-04-30 14:51:15 |
合計ジャッジ時間 | 11,843 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,812 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 12 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 25 ms
8,044 KB |
testcase_09 | AC | 51 ms
12,024 KB |
testcase_10 | AC | 18 ms
7,940 KB |
testcase_11 | AC | 12 ms
10,312 KB |
testcase_12 | TLE | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
ソースコード
#include <stdio.h> #include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define Inf 2000000001 int dis[10001][1<<12]; int main(){ int N,M,K; cin>>N>>M>>K; vector<int> R(K); rep(i,K){ cin>>R[i]; R[i]--; } vector<int> a(M),b(M),c(M),d(M,0); vector<vector<int>> E(N); rep(i,M){ cin>>a[i]>>b[i]>>c[i]; a[i]--;b[i]--; E[a[i]].push_back(i); E[b[i]].push_back(i); } rep(i,K){ d[R[i]] = 1<<i; } rep(i,N){ rep(j,1<<K)dis[i][j] = Inf; } dis[0][0] = 0; priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>> Q; Q.emplace(0,make_pair(0,0)); while(Q.size()>0){ int D = Q.top().first; int u = Q.top().second.first; int B = Q.top().second.second; Q.pop(); rep(i,E[u].size()){ int ind = E[u][i]; int v = u ^ a[ind] ^ b[ind]; int DD = D + c[ind]; int BB = B | d[ind]; if(dis[v][BB] > DD){ dis[v][BB] = DD; Q.emplace(DD,make_pair(v,BB)); } } } cout<<dis[N-1][(1<<K)-1]<<endl; return 0; }