Submission #1335856

#TimeUsernameProblemLanguageResultExecution timeMemory
1335856MunkhErdeneCyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define ull unsigned long long
#define lll __int128
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define BlueCrowner ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
const ll mod = 1e9 + 7;
const ll mod1 = 998244353;
const ll naim = 1e9;
const ll max_bit = 60;
const ull tom = ULLONG_MAX;
const ll MAXN = 100005;
const ll LOG = 20;
const ll NAIM = 1e18;
const ll N = 2e6 + 5;
double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr) {
    ll n = N, m = M, k = K, h = H;
    k = min(70, k);
    vector<vector<pair<ll, ll>>> g(n);
    FOR(i, 0, m) {
        ll u = x[i], v = y[i], w = c[i];
        g[u].pb({v, w});
        g[v].pb({u, w});
    }
    vector<vector<double>> dp(k + 1, vector<double>(n, NAIM));
    dp[0][0] = 0;
    double ans = NAIM;
    FOR(i, 0, k + 1) {
        priority_queue<pair<double, ll>, vector<pair<double, ll>>, greater<pair<double, ll>>> pq;
        FOR(j, 0, n) if(dp[i][j] < NAIM) pq.push({dp[i][j], j});
        while(!pq.empty()) {
            auto [d, u] = pq.top(); pq.pop();
            if(d > dp[i][u] || u == h) continue;
            for(auto &[v, d1] : g[u]) {
                if(arr[v] == 2) {
                    if(i < k) {
                        if((double)(dp[i][u] + d1) / 2.0 < dp[i + 1][v]) {
                            dp[i + 1][v] = (double)(dp[i][u] + d1) / 2.0;
                        }
                    }
                }

                if(arr[v] == 0) {
                    if(dp[i][v] > 0) {
                        dp[i][v] = 0;
                        pq.push({0, v});
                    }
                }
                else if(dp[i][u] + d1 < dp[i][v]) {
                    dp[i][v] = dp[i][u] + d1;
                    pq.push({dp[i][v], v});
                }
            }
        }
    }
    FOR(i, 0, k + 1) ans = min(ans, dp[i][h]);
    return (ans >= 1e17 ? -1 : ans);
    
    
}

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:28:12: error: no matching function for call to 'min(int, long long int&)'
   28 |     k = min(70, k);
      |         ~~~^~~~~~~
In file included from /usr/include/c++/13/vector:62,
                 from cyberland.h:1,
                 from cyberland.cpp:1:
/usr/include/c++/13/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
cyberland.cpp:28:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |     k = min(70, k);
      |         ~~~^~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
cyberland.cpp:28:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   28 |     k = min(70, k);
      |         ~~~^~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from cyberland.cpp:2:
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
cyberland.cpp:28:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |     k = min(70, k);
      |         ~~~^~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
cyberland.cpp:28:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |     k = min(70, k);
      |         ~~~^~~~~~~