#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define vi vector<int>
#define ve vector
#define ll long long
#define vl vector<ll>
#define vll vector<pair<ll,ll>>
#define onbit __builtin_popcount
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 1e18
#define eps 1e-7
#define eps1 1e-2
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 1e5+5
using namespace std;
using namespace __gnu_pbds;
template <class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int MOD = 1e9+7;
const int nax = 1e5+5;
const int MAX_VAL = 1e9;
double PI=3.14159265359;
int arx[8]={1,1,0,-1,-1,-1, 0, 1};
int ary[8]={0,1,1, 1, 0,-1,-1,-1};
typedef complex<int> Point;
#define X real()
#define Y imag()
/*void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}*/
vector<pair<int,int>> adj[nax];
vector<int> dis(nax);
int dp[nax];
vector<bool> tab(nax);
bool vis[nax];
signed travel_plan(signed n, signed m, signed R[][2], signed L[], signed k, signed P[]){
vi bahma(k);
vl a(n,1e15);
vl b(n,1e15);
memset(dp,-1,sizeof dp);
for(int i = 0; i < m; i++) {
int x = R[i][0];
int y = R[i][1];
int t = L[i];
adj[x].pb({y, t});
adj[y].pb({x, t});
}
priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<>> pq;
for (int i = 0; i < k; ++i)
{
pq.push({0,L[i]});
}
while(!pq.empty())
{
ll x=pq.top().fi;
int y=pq.top().se;
pq.pop();
if (y==0)
{
return x;
}
if (vis[y]) continue;
vis[y]=true;
for(auto u:adj[y])
{
int node=u.fi;
int d=u.se;
if (a[node]>d+x){
b[node]=a[node];
a[node]=d+x;
}else if(b[node]>d+x){
b[node]=d+x;
}
pq.push({b[node],node});
}
}
}
/*int main(){
optimise;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
//setIO("pump");
}*/
Compilation message
crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:45:15: warning: control reaches end of non-void function [-Wreturn-type]
45 | vi bahma(k);
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
3412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |