제출 #957918

#제출 시각아이디문제언어결과실행 시간메모리
957918MtSaka사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include "cyberland.h" #include<bits/stdc++.h> #define overload(a,b,c,d,...) d #define rep1(a) for(ll _=0;_<(ll)a;++_) #define rep2(i,n) for(ll i=0;i<(ll)n;++i) #define rep3(i,l,r) for(ll i=(ll)l;i<(ll)r;++i) #define rep(...) overload(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__) #define rrep1(i,a) for(ll i=(ll)a-1;i>=0;--i) #define rrep2(i,a,b) for(ll i=(ll)b-1;i>=(ll)a;--i) #define rrep(...) overload(__VA_ARGS__,rrep2,rrep1)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define pb push_back #define eb emplace_back using namespace std; using ll=long long; using ull=unsigned long long; using ld=long double; template<typename T,typename U>inline bool chmin(T&a,const U&b){return (a>b?a=b,true:false);} template<typename T,typename U>inline bool chmax(T&a,const U&b){return (a<b?a=b,true:false);} static constexpr ll inf=numeric_limits<ll>::max()/2; using vl=vector<ll>; using ld=long double; static constexpr ld eps=1e-8; 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){ chmin(K,100); vector<vector<ld>>dist(N,vector<ld>(K+1,inf)); vector<vector<pair<ll,ll>>>g(N); vl vis(N,0); rep(i,M){ g[x[i]].eb(y[i],c[i]); g[y[i]].eb(x[i],c[i]); } auto dfs=[&](auto&&dfs,int v)->void { for(auto [u,c]:g[v]){ if(vis[u]||u==H)continue; vis[u]=1; dfs(dfs,u); } }; vis[0]=1; dfs(dfs,0); priority_queue<tuple<ld,ll,ll>,vector<tuple<ld,ll,ll>>,greater<>>pq; rep(i,N){ if(vis[i]&&(i==0||arr[i]==0)){ dist[i][K]=0; pq.emplace(0,i,K); } } rep(i,K){ priority_queue<tuple<ld,ll,ll>,vector<tuple<ld,ll,ll>>,greater<>>npq; while(!pq.empty()){ auto [d,v,k]=pq.top();pq.pop(); if(dist[v][k]!=d)continue; if(v==H)continue; for(auto [u,cost]:g[v]){ if(dist[u][k]-(ld)(d+(ld)cost)>eps){ dist[u][k]=(ld)(d+(ld)cost); pq.emplace(dist[u][k],u,k); } if(k-1>=0&&arr[u]==2&&dist[u][k-1]-(ld)(d+(ld)cost)/2.0>eps){ dist[u][k-1]=(ld)(d+cost)/2.0; npq.emplace(dist[u][k-1],u,k-1); } } } pq=move(npq); } ld res=inf; rep(i,K+1)chmin(res,dist[H][i]); if(res==inf)return -1; return res; } int main(){ cout<<solve(3, 2, 30, 2, {1, 2}, {2, 0}, {12, 4}, {1, 2, 1}); }

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

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