#include <bits/stdc++.h>
#include "crocodile.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define MASK(i) (1ULL << (i))
#define GETBIT(mask, i) (((mask) >> (i)) & 1)
#define ALL(v) (v).begin(), (v).end()
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}
ll LASTBIT(ll mask){return (mask) & (-mask);}
int pop_cnt(ll mask){return __builtin_popcountll(mask);}
int ctz(ull mask){return __builtin_ctzll(mask);}
int logOf(ull mask){return 63 - __builtin_clzll(mask);}
mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);}
template <class T1, class T2>
bool maximize(T1 &a, T2 b){
if (a < b) {a = b; return true;}
return false;
}
template <class T1, class T2>
bool minimize(T1 &a, T2 b){
if (a > b) {a = b; return true;}
return false;
}
template <class T>
void printArr(T& container, string separator = " ", string finish = "\n", ostream &out = cout){
for(auto item: container) out << item << separator;
out << finish;
}
template <class T>
void remove_dup(vector<T> &a){
sort(ALL(a));
a.resize(unique(ALL(a)) - a.begin());
}
struct P{
int i; ll w;
P(){}
P(int _i, ll _w){i = _i, w = _w;}
};
struct compare{
bool operator () (P a, P b){return a.w > b.w;}
};
const int N = 1e5 + 69;
const ll INF = 1e18 + 69;
vector<P> graph[N];
int travel_plan(int n, int m, int R[][2], int L[], int K, int E[]){
for(int i = 0; i<m; ++i){
int u = R[i][0], v = R[i][1];
ll w = L[i];
graph[u].push_back(P(v, w));
graph[v].push_back(P(u, w));
}
vector<ll> dis(n, INF);
for(int i = 0; i<K; ++i) {
int u = E[i];
dis[u] = 0;
}
for(int i = 0; i<n; ++i) {
pair<ll, int> chode = {INF, -1};
if (dis[i] == INF){
pair<ll, ll> mi = {INF, INF};
for(P v: graph[i]){
ll val = dis[v.i] + v.w;
if (mi.first > val){
mi.second = mi.first;
mi.first = val;
}
else minimize(mi.second, val);
}
minimize(chode, make_pair(mi.second, i));
}
dis[chode.second] = chode.first;
if (chode.second == 0) break;
}
return dis[0];
}
// int main(void){
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// return 0;
// }
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
8 ms |
13404 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
8 ms |
13404 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
8 ms |
13404 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |