Submission #713665

#TimeUsernameProblemLanguageResultExecution timeMemory
713665MarwenElarbiCrocodile's Underground City (IOI11_crocodile)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define vi vector<int> #define ve vector #define ll long long #define vl vector<ll> #define vll vector<pair<ll,ll>> #define onbit __builtin_popcount #define ii pair<int,int> #define vvi vector<vi> #define vii vector<ii> #define gii greater<ii> #define pb push_back #define mp make_pair #define fi first #define se second #define INF 1e18 #define eps 1e-7 #define eps1 1e-2 #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define MAX_A 1e5+5 using namespace std; using namespace __gnu_pbds; template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int MOD = 1e9+7; const int nax = 1e5+5; const int MAX_VAL = 1e9; double PI=3.14159265359; int arx[8]={1,1,0,-1,-1,-1, 0, 1}; int ary[8]={0,1,1, 1, 0,-1,-1,-1}; typedef complex<int> Point; #define X real() #define Y imag() template<typename T, typename U> ostream & operator << (ostream &out, const pair<T, U> &c) { out << c.first << ' ' << c.second; return out; } template<typename T> ostream & operator << (ostream &out, vector<T> &v) { const int sz = v.size(); for (int i = 0; i < sz; i++) { if (i) out << ' '; out << v[i]; } return out; } template<typename T> istream & operator >> (istream &in, vector<T> &v) { for (T &x : v) in >> x; return in; } /*void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); }*/ vector<pair<int,int>> adj[nax]; vector<int> dis(nax); int dp[nax]; vector<bool> tab(nax); bool vis[nax]; ll travel_plan(int N, int M, int R[][2], int L[], int K, int P[]){ int n = N; vi bahma(K); memset(dp,-1,sizeof dp); for(int i = 0; i < M; i++) { int x = R[i][0]; int y = R[i][1]; int t = L[i]; bahma[i]=L[i]; tab[L[i]]=1; adj[x].pb({y, t}); adj[y].pb({x, t}); } for (int i = 0; i < K; ++i) { int x; cin>>x; bahma[i]=x; tab[x]=1; } priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<>> pq; for (int i = 0; i < K; ++i) { pq.push({0,bahma[i]}); } while(!pq.empty()) { ll x=pq.top().fi; int y=pq.top().se; pq.pop(); if (y==0) { cout << x<<endl; return 0; } if (vis[y]) continue; vis[y]=true; for(auto u:adj[y]) { int node=u.fi; int d=u.se; if (a[node]>d+x){ b[node]=a[node]; a[node]=d+x; }else if(b[node]>d+x){ b[node]=d+x; } pq.push({b[node],node}); } } } /*int main(){ optimise; #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif //setIO("pump"); }*/

Compilation message (stderr)

crocodile.cpp: In function 'long long int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:106:17: error: 'a' was not declared in this scope
  106 |             if (a[node]>d+x){
      |                 ^
crocodile.cpp:107:17: error: 'b' was not declared in this scope
  107 |                 b[node]=a[node];
      |                 ^
crocodile.cpp:109:22: error: 'b' was not declared in this scope
  109 |             }else if(b[node]>d+x){
      |                      ^
crocodile.cpp:112:22: error: 'b' was not declared in this scope
  112 |             pq.push({b[node],node});
      |                      ^
crocodile.cpp:112:35: error: no matching function for call to 'std::priority_queue<std::pair<long long int, int>, std::vector<std::pair<long long int, int> >, std::greater<void> >::push(<brace-enclosed initializer list>)'
  112 |             pq.push({b[node],node});
      |                                   ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from crocodile.cpp:1:
/usr/include/c++/10/bits/stl_queue.h:640:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int> >; _Compare = std::greater<void>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, int>]'
  640 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/10/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::pair<long long int, int>&'}
  640 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/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::pair<long long int, int>; _Sequence = std::vector<std::pair<long long int, int> >; _Compare = std::greater<void>; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, int>]'
  648 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/10/bits/stl_queue.h:648:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, int>, std::vector<std::pair<long long int, int> >, std::greater<void> >::value_type&&' {aka 'std::pair<long long int, int>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
crocodile.cpp:66:9: warning: unused variable 'n' [-Wunused-variable]
   66 |     int n = N;
      |         ^
crocodile.cpp:67:15: warning: control reaches end of non-void function [-Wreturn-type]
   67 |     vi bahma(K);
      |               ^