제출 #1082404

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
10824042024-08-31 09:52:43dwuyCities (BOI16_cities)C++14
100 / 100
1987 ms50252 KiB
#include <bits/stdc++.h>
#define MASK(x) (1LL<<(x))
using namespace std;
typedef long long ll;
const int MX = 100005;
int n, k, m;
int city[5];
ll f[MASK(5)][MX];
vector<pair<int, ll>> G[MX];
void nhap(){
cin >> n >> k >> m;
for(int i=0; i<k; i++) cin >> city[i];
for(int i=1; i<=m; i++){
int u, v, c;
cin >> u >> v >> c;
G[u].push_back({v, c});
G[v].push_back({u, c});
}
}
void solve(){
memset(f, 0x3f, sizeof f);
for(int mask=1; mask<MASK(k); mask++){
if(mask-(-mask&mask) == 0){
f[mask][city[__lg(mask)]] = 0;
}
else for(int Mask=mask; Mask>0; Mask=(Mask - 1)&mask){
for(int i=1; i<=n; i++){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...