Submission #550689

#TimeUsernameProblemLanguageResultExecution timeMemory
550689beaconmcCrocodile's Underground City (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "crocodile.h"
    
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
    
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define INF 2000000000
    
vector<ll> dist[100001];
vector<vector<ll>> edges[100001];
    
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){
    
    FOR(i,0,M){
        edges[R[i][0]].push_back({edges[R[i][1]], L[i]});
        edges[R[i][1]].push_back({edges[R[i][0]], L[i]});
    }
    priority_queue<vector<ll>,vector<vector<ll>>,greater<vector<ll>>> pq;
    FOR(i,0,N){
        dist[i] = {INF, INF};
    }
    FOR(i,0,K){
        dist[P[i]] = {0,0};
        pq.push({0,P[i]});
    }
    
    
    while (pq.size()){
        vector<ll> node = pq.top();
        pq.pop();
    
        if (node[0] != dist[node[1]][1]) continue;
        for (auto&i : edges[node[1]]){
            if (node[0]+i[1] <= dist[i[0]][0]){
                dist[i[0]][1] = dist[i[0]][0];
                dist[i[0]][0] = node[0]+i[1];
            } else if (node[0]+i[1] < dist[i[0]][1] && node[0]+i[1] > dist[i[0]][0]){
                dist[i[0]][1] = node[0]+i[1];
            }else{
                continue;
            }
    
            pq.push({dist[i[0]][1], i[0]});
        }
    }
    
    return dist[0][1];
    
}

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:22:56: error: no matching function for call to 'std::vector<std::vector<long long int> >::push_back(<brace-enclosed initializer list>)'
   22 |         edges[R[i][0]].push_back({edges[R[i][1]], L[i]});
      |                                                        ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from crocodile.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::vector<long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::vector<long long int> >::value_type&&' {aka 'std::vector<long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
crocodile.cpp:23:56: error: no matching function for call to 'std::vector<std::vector<long long int> >::push_back(<brace-enclosed initializer list>)'
   23 |         edges[R[i][1]].push_back({edges[R[i][0]], L[i]});
      |                                                        ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from crocodile.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<long long int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::vector<long long int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::vector<long long int>; _Alloc = std::allocator<std::vector<long long int> >; std::vector<_Tp, _Alloc>::value_type = std::vector<long long int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::vector<long long int> >::value_type&&' {aka 'std::vector<long long int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~