제출 #985007

#제출 시각아이디문제언어결과실행 시간메모리
985007shjeong사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include <vector> #include <iostream> #include <cmath> #include <algorithm> #include <numeric> #include <cstring> #include <vector> #include <string> #include <climits> #include <map> #include <set> #include <stack> #include <queue> #include <bitset> #include <cassert> #include <list> using namespace std; #define all(x) x.begin(), x.end() #define rll(x) x.rbegin(), x.rend() #define comp(x) x.erase(unique(all(x)), x.end()) #define MOD 1000000007 #define MOD2 998244353 #define debug(x) cout << #x<<" is "<<x<<"\n"; #define X first #define Y second #define DEB cout<<"[DEBUG]" #define PAIR(a,b) "("<<a<<", "<<b<<")" #define PRINT1(V) DEB<<#V<<endl; for(auto i : V)DEB<<i<<"\n" #define PRINT2(V) DEB<<#V<<endl; for(auto [a,b] : V)DEB<<PAIR(a,b)<<"\n"; typedef long long ll; typedef __int128_t lll; typedef long double ld; typedef pair<ll,ll> P; typedef pair<ll,P> PP; typedef pair<ld,ll> Pd; vector<P> adj[202020]; ld dist[202020]; ll p[202020]; ll find(ll x){ if(p[x]<0)return x; return p[x] = find(p[x]); } void merge(ll x, ll y){ x = find(x), y = find(y); if(x==y)return; p[y]=x; } double solve(int N, int M, int K, int H, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) { for(int i = 0 ; i < N ; i++){ dist[i] = 1e15; adj[i].clear(); p[i]=-1; } for(int i = 0 ; i < M ; i++){ merge(x[i],y[i]); adj[x[i]].push_back({y[i],c[i]}); adj[y[i]].push_back({x[i],c[i]}); } priority_queue<Pd,vector<Pd>,greater<Pd>> pq; for(int i = 0 ; i < N ; i++)if(arr[i]==0 and find(0) == find(i))dist[i]=0, pq.push({0,i}); dist[0] = 0; pq.push({0,0}); while(pq.size()){ auto [d,cur] = pq.top(); pq.pop(); if(dist[cur] < d)continue; for(auto [next,w] : adj[cur]){ if(dist[next] > dist[cur] + w){ dist[next] = dist[cur]+w; pq.push({dist[cur]+w,next}); } } } if(dist[H]==1e15)return -1; return (double)dist[H]; } int main() { int T; assert(1 == scanf("%d", &T)); while (T--){ int N,M,K,H; assert(4 == scanf("%d %d %d\n%d", &N, &M, &K, &H)); std::vector<int> x(M); std::vector<int> y(M); std::vector<int> c(M); std::vector<int> arr(N); for (int i=0;i<N;i++) assert(1 == scanf("%d", &arr[i])); for (int i=0;i<M;i++) assert(3 == scanf("%d %d %d", &x[i], &y[i], &c[i])); printf("%.12lf\n", solve(N, M, K, H, x, y, c, arr)); } }

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

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