Submission #207581

#TimeUsernameProblemLanguageResultExecution timeMemory
207581aloo123Crocodile's Underground City (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <crocodile.h> #define ll int #define pb push_back #define mp make_pair #define s second #define f first using namespace std; #define pii pair<int,int> const int INF = INT_MAX; int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){ vector<pii> adj[n]; for(int i =0;i<m;i++){ int u = r[i][0]; int v = r[i][1]; int d = l[i]; adj[u].push_back(make_pair(u,d)); adj[v].push_back(make_pair(v,d)); } pii dis[n]; int actual[n]; for(int i =0;i<n;i++) dis[i] = mp(INF,INF),actual[i]=INF; priority_queue<pii,vector<pii>,greater<pii>> pq; for(int i =0;i<k;i++){ ll u = p[i]; pq.push(mp(0,u)); dis[u].f = 0; dis[u].s = 0; actual[u] = 0; } vector<bool> vis(n,false); while(!pq.empty()){ pii u = pq.top(); pq.pop(); if(vis[u]) continue; vis[u]=true; for(auto v:adj[u.s]){ int Dist = actual[u] + v.s; int V = v.f; if(Dist <= dis[V].f){ dis[V].s = dis[V].f; dis[V].f = Dist; actual[V] = dis[V].f; pq.push(mp(actual[V],V)); } else if(Dist < dis[V].s){ dis[V].s = Dist; } } } return dis[0].s; }

Compilation message (stderr)

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:36:9: error: no match for 'operator[]' (operand types are 'std::vector<bool>' and 'std::pair<int, int>')
   if(vis[u]) continue;
         ^
In file included from /usr/include/c++/7/vector:65:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from crocodile.cpp:1:
/usr/include/c++/7/bits/stl_bvector.h:856:5: note: candidate: std::vector<bool, _Alloc>::reference std::vector<bool, _Alloc>::operator[](std::vector<bool, _Alloc>::size_type) [with _Alloc = std::allocator<bool>; std::vector<bool, _Alloc>::reference = std::_Bit_reference; std::vector<bool, _Alloc>::size_type = long unsigned int]
     operator[](size_type __n)
     ^~~~~~~~
/usr/include/c++/7/bits/stl_bvector.h:856:5: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<bool>::size_type {aka long unsigned int}'
/usr/include/c++/7/bits/stl_bvector.h:863:5: note: candidate: std::vector<bool, _Alloc>::const_reference std::vector<bool, _Alloc>::operator[](std::vector<bool, _Alloc>::size_type) const [with _Alloc = std::allocator<bool>; std::vector<bool, _Alloc>::const_reference = bool; std::vector<bool, _Alloc>::size_type = long unsigned int]
     operator[](size_type __n) const
     ^~~~~~~~
/usr/include/c++/7/bits/stl_bvector.h:863:5: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<bool>::size_type {aka long unsigned int}'
crocodile.cpp:37:6: error: no match for 'operator[]' (operand types are 'std::vector<bool>' and 'std::pair<int, int>')
   vis[u]=true;
      ^
In file included from /usr/include/c++/7/vector:65:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from crocodile.cpp:1:
/usr/include/c++/7/bits/stl_bvector.h:856:5: note: candidate: std::vector<bool, _Alloc>::reference std::vector<bool, _Alloc>::operator[](std::vector<bool, _Alloc>::size_type) [with _Alloc = std::allocator<bool>; std::vector<bool, _Alloc>::reference = std::_Bit_reference; std::vector<bool, _Alloc>::size_type = long unsigned int]
     operator[](size_type __n)
     ^~~~~~~~
/usr/include/c++/7/bits/stl_bvector.h:856:5: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<bool>::size_type {aka long unsigned int}'
/usr/include/c++/7/bits/stl_bvector.h:863:5: note: candidate: std::vector<bool, _Alloc>::const_reference std::vector<bool, _Alloc>::operator[](std::vector<bool, _Alloc>::size_type) const [with _Alloc = std::allocator<bool>; std::vector<bool, _Alloc>::const_reference = bool; std::vector<bool, _Alloc>::size_type = long unsigned int]
     operator[](size_type __n) const
     ^~~~~~~~
/usr/include/c++/7/bits/stl_bvector.h:863:5: note:   no known conversion for argument 1 from 'std::pair<int, int>' to 'std::vector<bool>::size_type {aka long unsigned int}'
crocodile.cpp:39:21: error: no match for 'operator[]' (operand types are 'int [n]' and 'std::pair<int, int>')
    int Dist = actual[u] + v.s;
                     ^