제출 #1126285

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
11262852024-12-12 17:00:46psm9352사이버랜드 (APIO23_cyberland)C++20
44 / 100
36 ms9544 KiB
#include <vector>
#include <queue>
using namespace std;
double solve(int N, int M, int K, int H, vector<int> x, vector<int>y, vector<int> c, vector<int> arr){
priority_queue<pair<double,int>,vector<pair<double,int>>,greater<pair<double,int>>> pq; // {val,node}
vector<vector<pair<int,double>>> graph(N);
for (int i = 0;i<M;i++){
graph[x[i]].push_back({y[i],c[i]});
graph[y[i]].push_back({x[i],c[i]});
}
pq.push({0.0,H});
vector<double> ans(N,1e18);ans[H]=0;
vector<int> visited(N,0);
while(!pq.empty()){
int node = pq.top().second;
pq.pop();
if (visited[node]){continue;}
visited[node]=1;
for (pair<int,double> next:graph[node]){
if (ans[node]+next.second<ans[next.first]){
ans[next.first]=next.second+ans[node];
pq.push({ans[next.first],next.first});
}
}
}
queue<int> q;
q.push(0);
vector<bool> pos(N,0);
for (int i = 0;i<N;i++){visited[i]=0;}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...