Submission #917520

#TimeUsernameProblemLanguageResultExecution timeMemory
917520shenfe1Cyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cyberland.h" using namespace std; #define ll long long #define ld long double #define pb push_back #define pf push_front #define pii pair<int,int> #define all(v) v.begin(),v.end() #define F first #define S second #define mem(a,i) memset(a,i,sizeof(a)) #define sz(s) (int)s.size() #define y1 yy #define ppb pop_back #define lb lower_bound #define ub upper_bound #define gcd(a,b) __gcd(a,b) #define in insert // #define int ll const int MAX=1e5+15; const ld inf=1e18; vector<pii> g[MAX]; ld dp[MAX][32]; double solve(int n,int m,int k,int h,vector<int> arr,vector<int> x,vector<int> y,vector<int> c){ for(int i=0;i<m;i++){ x[i]++; y[i]++; g[x[i]].pb({y[i],c[i]}); g[y[i]].pb({x[i],c[i]}); // cout<<x[i]<<" "<<y[i]<<" "<<c[i]<<"\n"; } h++; for(int i=1;i<=n;i++){ for(int j=0;j<=k;j++)dp[i][j]=inf; } dp[1][0]=0; priority_queue<pair<ld,pii>> q; q.push({0,{1,0}}); while(!q.empty()){ pair<ld,pii> boofer=q.top(); q.pop(); int v=boofer.S.F,c=boofer.S.S; if(dp[v][c]<boofer.F||v==h)continue; // cout<<v<<" "<<c<<" "<<dp[v][c]<<"\n"; for(auto to:g[v]){ if(arr[to.F-1]==0){ if(dp[to.F][c]>0){ dp[to.F][c]=0; q.push({dp[to.F][c],{to.F,c}}); } } else if(arr[to.F-1]==1){ if(dp[v][c]+to.S<dp[to.F][c]){ dp[to.F][c]=dp[v][c]+to.S; q.push({dp[to.F][c],{to.F,c}}); } } else{ if(dp[v][c]+to.S<dp[to.F][c]){ dp[to.F][c]=dp[v][c]+to.S; q.push({dp[to.F][c],{to.F,c}}); } if(c+1<=k&&(dp[v][c]+to.S)/2<dp[to.F][c+1]){ dp[to.F][c+1]=(dp[v][c]+to.S)/2; q.push({dp[to.F][c+1],{to.F,c+1}}); } } } } double ans=inf; for(int i=0;i<=k;i++)ans=min(ans,dp[h][i]); return ans; } // int main(){ // int n,m,k,h; // cin>>n>>m>>k>>h; // vector<int> arr(n); // for(int i=0;i<n;i++)cin>>arr[i]; // vector<int> x(m),y(m),c(m); // for(int i=0;i<m;i++)cin>>x[i]>>y[i]>>c[i]; // cout<<solve(n,m,k,h,arr,x,y,c); // }

Compilation message (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:77:44: error: no matching function for call to 'min(double&, long double&)'
   77 |   for(int i=0;i<=k;i++)ans=min(ans,dp[h][i]);
      |                                            ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 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:77:44: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long double')
   77 |   for(int i=0;i<=k;i++)ans=min(ans,dp[h][i]);
      |                                            ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 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:77:44: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'long double')
   77 |   for(int i=0;i<=k;i++)ans=min(ans,dp[h][i]);
      |                                            ^
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:1:
/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:77:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   77 |   for(int i=0;i<=k;i++)ans=min(ans,dp[h][i]);
      |                                            ^
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:1:
/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:77:44: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   77 |   for(int i=0;i<=k;i++)ans=min(ans,dp[h][i]);
      |                                            ^