제출 #756950

#제출 시각아이디문제언어결과실행 시간메모리
756950Valters07사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cyberland.h" #define ll long long #define pb push_back #define fi first #define se second using namespace std; const int N = 1e5+5; const int K = 30+2; vector<pair<int,int> > g[N]; long double dist[N][K]; bool vis[N][K], vis2[N]; vector<int> starts, arr2; void dfs(int u, int h) { vis2[u]=1; if(arr2[u]==0) starts.pb(u); for(auto v:g[u]) if(!vis2[v.fi]&&v.fi!=h) dfs(v.fi,h); } long double solve(int n, int m, int k, int h, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) { arr2=arr; for(int i = 0;i<m;i++) g[x[i]].pb({y[i],c[i]}), g[y[i]].pb({x[i],c[i]}); for(int i = 0;i<n;i++) for(int j = 0;j<=k;j++) dist[i][j]=1e15, vis[i][j]=0; priority_queue<pair<long double,pair<int,int> >,vector<pair<long double,pair<int,int> > >,greater<pair<long double,pair<int,int> > > > q[k+1]; dist[0][0]=0; q[0].push({0,{0,0}}); for(int i = 0;i<n;i++) vis2[i]=0; dfs(0,h); for(auto x:starts) q[0].push({0,{x,0}}), dist[x][0]=0; starts.clear(); for(int i = 0;i<=k;i++) vis[h][i]=1; for(int qi = 0;qi<=k;qi++) { while(!q[qi].empty()) { int u = q[qi].top().se.fi, dv = q[qi].top().se.se; q[qi].pop(); if(vis[u][dv]) continue; vis[u][dv]=1; for(auto v:g[u]) { long double nwc = dist[u][dv]+v.se; if(dist[v.fi][dv]>nwc) dist[v.fi][dv]=nwc, q[qi].push({nwc,{v.fi,dv}}); if(arr[v.fi]==2&&dv<k) { nwc/=2; if(dist[v.fi][dv+1]>nwc) dist[v.fi][dv+1]=nwc, q[qi].push({nwc,{v.fi,dv+1}}); } } } } long double best = 1e15; for(int i = 0;i<=k;i++) best=min(best,dist[h][i]); for(int i = 0;i<n;i++) g[i].clear(); if(best>=2e14) return -1; return best; }

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

cyberland.cpp:23:13: error: ambiguating new declaration of 'long double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
   23 | long double solve(int n, int m, int k, int h, vector<int> x,
      |             ^~~~~
In file included from cyberland.cpp:2:
cyberland.h:3:8: note: old declaration 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)'
    3 | 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);
      |        ^~~~~