제출 #932025

#제출 시각아이디문제언어결과실행 시간메모리
932025Edu175사이버랜드 (APIO23_cyberland)C++17
컴파일 에러
0 ms0 KiB
#include "cyberland.h" #include <bits/stdc++.h> #define pb push_back #define fst first #define snd second #define fore(i,a,b) for(ll i=a,apio=b;i<apio;i++) #define SZ(x) ((int)x.size()) #define ALL(x) x.begin(),x.end() #define mset(a,v) memset((a),(v),sizeof(a)) #define imp(v) for(auto slkdh:v)cout<<slkdh<<" ";cout<<"\n" using namespace std; typedef long long ll; typedef long double ld; typedef pair<ll,ll> ii; typedef pair<ll,pair<ld,ll>> node; const ll MAXN=1e5+5; vector<pair<ll,ll>>g[MAXN]; ll h; ll vis[MAXN]; void dfs(ll x){ vis[x]=1; for(auto [y,sg]:g[x])if(!vis[y]&&y!=h)dfs(y); } 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) { ll n=N,m=M,k=K; k=min(k,70); h=H; vector<ll>a(n); fore(i,0,n)a[i]=arr[i]; fore(i,0,n){ g[i].clear(); vis[i]=0; } fore(i,0,m){ g[x[i]].pb({y[i],c[i]}); g[y[i]].pb({x[i],c[i]}); } dfs(0); ld d[n][k+5]; fore(i,0,n)fore(j,0,k+5)d[i][j]=-1; priority_queue<node,vector<node>,greater<node>>pq; a[0]=0; fore(i,0,n)if(vis[i]&&!a[i]){ pq.push({0,{0,i}}); d[i][0]=0; } ld res=-1; while(SZ(pq)){ auto [u,par]=pq.top(); pq.pop();// w=-w; auto [w,x]=par; if(d[x][u]<w)continue; if(x==h){ if(res==-1||w<res)res=w; continue; } //cout<<x<<" "<<u<<": "<<w<<"\n"; for(auto [y,w]:g[x]){ ld nd=d[x][u]+w;//double(1ll<<u); if(d[y][u]<-0.5||nd<d[y][u]) d[y][u]=nd,pq.push({u,{nd,y}}); if(a[y]==2){ nd/=2.0; ll v=u+1; if(v>k)continue; if(d[y][v]<-0.5||nd<d[y][v]) d[y][v]=nd,pq.push({v,{nd,y}}); } } } return res; }

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

cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:27:15: error: no matching function for call to 'min(ll&, int)'
   27 |     k=min(k,70);
      |               ^
In file included from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
cyberland.cpp:27:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |     k=min(k,70);
      |               ^
In file included from /usr/include/c++/10/vector:60,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
cyberland.cpp:27:15: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   27 |     k=min(k,70);
      |               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from cyberland.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
cyberland.cpp:27:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |     k=min(k,70);
      |               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from cyberland.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
cyberland.cpp:27:15: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   27 |     k=min(k,70);
      |               ^