Submission #1187670

#TimeUsernameProblemLanguageResultExecution timeMemory
1187670ThanhsCyberland (APIO23_cyberland)C++20
Compilation error
0 ms0 KiB
#pragma GCC opmize("Ofast", unroll-loops)
#pragma GCC target("arch=skylake")
#include <bits/stdc++.h>
using namespace std;

#define name "TENBAI"
#define setmin(x, y) x = min((x), (y))
#define setmax(x, y) x = max((x), (y))

mt19937 hdp(chrono::high_resolution_clock::now().time_since_epoch().count());
int rand(int l, int r){return l + ((hdp() % (r - l + 1)) + r - l + 1) % (r - l + 1);}

const double inf = 1 / .0;
const int NM = 1e5 + 5;

double dist[NM][71];

double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> a)
{
    setmin(K, 70);
    fill(dist[0], dist[0] + N * 71, inf);
    vector<vector<pair<int, int>>> g(N);
    for (int i = 0; i < M; i++)
        g[x[i]].push_back({y[i], c[i]}), g[y[i]].push_back({x[i], c[i]});
    vector<int> st(1, 0);
    vector<bool> vis(N, 0);
    priority_queue<tuple<double, int, int>, vector<tuple<double, int, int>>, greater<>> pq;
    while (st.size())
    {
        int u = st.back();
        st.pop_back();
        if (u == H)
            continue;
        vis[u] = 1;
        if (!a[u] || !u)
        {
            for (int i = 0; i <= K; i++)
                dist[u][i] = 0;
            pq.push({0, u, 0});
        }
        for (auto v : g[u])
            if (!vis[v.fi])
            {
                st.push_back(v.fi);
                vis[v.fi] = 1;
            }
    }
    while (pq.size())
    {
        auto u = get<1>(pq.top()), t = get<2>(pq.top());
        double d = get<0>(pq.top());
        pq.pop();
        if (dist[u][t] != d || u == H || (t && dist[u][t] > dist[u][t - 1]))
            continue;
        for (pair<int, int> v : g[u])
        {
            if (dist[v.fi][t] > d + v.se)
            {
                dist[v.fi][t] = d + v.se;
                pq.push({dist[v.fi][t], v.fi, t});
            }
            if (a[v.fi] == 2 && t + 1 <= K && dist[v.fi][t + 1] > (d + v.se) / 2.0)
            {
                dist[v.fi][t + 1] = (d + v.se) / 2.0;
                pq.push({dist[v.fi][t + 1], v.fi, t + 1});
            }
        }
    }
    double res = inf;
    for (int i = 0; i <= K; i++)
        setmin(res, dist[H][i]);
    if (res == inf)
        res = -1;
    return res;
}

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:42:24: error: 'struct std::pair<int, int>' has no member named 'fi'
   42 |             if (!vis[v.fi])
      |                        ^~
cyberland.cpp:44:32: error: 'struct std::pair<int, int>' has no member named 'fi'
   44 |                 st.push_back(v.fi);
      |                                ^~
cyberland.cpp:45:23: error: 'struct std::pair<int, int>' has no member named 'fi'
   45 |                 vis[v.fi] = 1;
      |                       ^~
cyberland.cpp:57:24: error: 'struct std::pair<int, int>' has no member named 'fi'
   57 |             if (dist[v.fi][t] > d + v.se)
      |                        ^~
cyberland.cpp:57:39: error: 'struct std::pair<int, int>' has no member named 'se'
   57 |             if (dist[v.fi][t] > d + v.se)
      |                                       ^~
cyberland.cpp:59:24: error: 'struct std::pair<int, int>' has no member named 'fi'
   59 |                 dist[v.fi][t] = d + v.se;
      |                        ^~
cyberland.cpp:59:39: error: 'struct std::pair<int, int>' has no member named 'se'
   59 |                 dist[v.fi][t] = d + v.se;
      |                                       ^~
cyberland.cpp:60:33: error: 'struct std::pair<int, int>' has no member named 'fi'
   60 |                 pq.push({dist[v.fi][t], v.fi, t});
      |                                 ^~
cyberland.cpp:60:43: error: 'struct std::pair<int, int>' has no member named 'fi'
   60 |                 pq.push({dist[v.fi][t], v.fi, t});
      |                                           ^~
cyberland.cpp:60:24: error: no matching function for call to 'std::priority_queue<std::tuple<double, int, int>, std::vector<std::tuple<double, int, int> >, std::greater<void> >::push(<brace-enclosed initializer list>)'
   60 |                 pq.push({dist[v.fi][t], v.fi, t});
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,
                 from cyberland.cpp:3:
/usr/include/c++/11/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::tuple<double, int, int>; _Sequence = std::vector<std::tuple<double, int, int> >; _Compare = std::greater<void>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<double, int, int>]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/11/bits/stl_queue.h:640:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::tuple<double, int, int>&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::tuple<double, int, int>; _Sequence = std::vector<std::tuple<double, int, int> >; _Compare = std::greater<void>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<double, int, int>]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/11/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::tuple<double, int, int>, std::vector<std::tuple<double, int, int> >, std::greater<void> >::value_type&&' {aka 'std::tuple<double, int, int>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
cyberland.cpp:62:21: error: 'struct std::pair<int, int>' has no member named 'fi'
   62 |             if (a[v.fi] == 2 && t + 1 <= K && dist[v.fi][t + 1] > (d + v.se) / 2.0)
      |                     ^~
cyberland.cpp:62:54: error: 'struct std::pair<int, int>' has no member named 'fi'
   62 |             if (a[v.fi] == 2 && t + 1 <= K && dist[v.fi][t + 1] > (d + v.se) / 2.0)
      |                                                      ^~
cyberland.cpp:62:74: error: 'struct std::pair<int, int>' has no member named 'se'
   62 |             if (a[v.fi] == 2 && t + 1 <= K && dist[v.fi][t + 1] > (d + v.se) / 2.0)
      |                                                                          ^~
cyberland.cpp:64:24: error: 'struct std::pair<int, int>' has no member named 'fi'
   64 |                 dist[v.fi][t + 1] = (d + v.se) / 2.0;
      |                        ^~
cyberland.cpp:64:44: error: 'struct std::pair<int, int>' has no member named 'se'
   64 |                 dist[v.fi][t + 1] = (d + v.se) / 2.0;
      |                                            ^~
cyberland.cpp:65:33: error: 'struct std::pair<int, int>' has no member named 'fi'
   65 |                 pq.push({dist[v.fi][t + 1], v.fi, t + 1});
      |                                 ^~
cyberland.cpp:65:47: error: 'struct std::pair<int, int>' has no member named 'fi'
   65 |                 pq.push({dist[v.fi][t + 1], v.fi, t + 1});
      |                                               ^~
cyberland.cpp:65:24: error: no matching function for call to 'std::priority_queue<std::tuple<double, int, int>, std::vector<std::tuple<double, int, int> >, std::greater<void> >::push(<brace-enclosed initializer list>)'
   65 |                 pq.push({dist[v.fi][t + 1], v.fi, t + 1});
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:86,
                 from cyberland.cpp:3:
/usr/include/c++/11/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::tuple<double, int, int>; _Sequence = std::vector<std::tuple<double, int, int> >; _Compare = std::greater<void>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<double, int, int>]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/11/bits/stl_queue.h:640:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::tuple<double, int, int>&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_queue.h:648:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::tuple<double, int, int>; _Sequence = std::vector<std::tuple<double, int, int> >; _Compare = std::greater<void>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::tuple<double, int, int>]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/11/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::tuple<double, int, int>, std::vector<std::tuple<double, int, int> >, std::greater<void> >::value_type&&' {aka 'std::tuple<double, int, int>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~