제출 #1126264

#제출 시각아이디문제언어결과실행 시간메모리
1126264psm9352사이버랜드 (APIO23_cyberland)C++20
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <iomanip> #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,0}); vector<double> ans(N,1e18);ans[0]=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}); } } } if (ans[H]>=1e18){return -1;} return ans[H]; } int main(){ int t;cin >> t; while(t--){ int n,m,k,h;cin >> n >> m >> k >> h; vector<int> arr(n); vector<int> x(m); vector<int> y(m); vector<int> c(m); for (int i = 0;i<n;i++){cin >> arr[i];} for (int i = 0;i<m;i++){ cin >> x[i] >> y[i] >> c[i]; } cout << fixed << setprecision(12) << solve(n,m,k,h,x,y,c,arr) << "\n"; } }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/ccnUHqPA.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccy4QilT.o:cyberland.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status