Submission #982095

#TimeUsernameProblemLanguageResultExecution timeMemory
982095vjudge1Cyberland (APIO23_cyberland)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define rep(a,b,c) for(int a=b; a<c; a++) #define repa(a,b) for(auto a:b) #define pll pair<ll, ll> #define fi first #define se second #define state array<double, 3> #define pb push_back #define ll long long using namespace std; const double inf=1e18; double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> arr){ vector<pll> adj[N]; rep(i,0,M){ adj[x[i]].pb({y[i],c[i]}); adj[y[i]].pb({x[i],c[i]}); } K=min(K,200) double dis[N][K]{}; rep(i,0,N) rep(j,0,K+1) dis[i][j]=inf; priority_queue<state, vector<state>, greater<state>> pq; pq.push({0,0,0}); dis[0][0]=0; while(pq.size()){ int u=pq.top()[2], k=pq.top()[0]; double w=pq.top()[1]; pq.pop(); if(dis[u][k]<w || u==H) continue; //cout<<u<<" "<<k<<" "<<w<<endl; if(arr[u]==2){ repa(v,adj[u]){ if(v.fi!=H && k<K && dis[u][k+1]>(dis[u][k]+v.se+v.se)/2){ dis[u][k+1]=(dis[u][k]+v.se+v.se)/2; pq.push({k+1,dis[u][k+1],u}); } } } repa(v,adj[u]){ if(dis[v.fi][k]>dis[u][k]+v.se){ dis[v.fi][k]=dis[u][k]+v.se; pq.push({k,dis[v.fi][k],v.fi}); } if(k<K && arr[v.fi]==2 && dis[v.fi][k+1]>(dis[u][k]+v.se)/2){ dis[v.fi][k+1]=(dis[u][k]+v.se)/2; pq.push({k+1,dis[v.fi][k+1],v.fi}); } if(!arr[v.fi] && dis[v.fi][k]){ dis[v.fi][k]=0; pq.push({k,dis[v.fi][k],v.fi}); } } } double ans=inf; rep(i,0,K+1) ans=min(ans,dis[H][i]); /*rep(i,0,N){ cout<<i<<": "; rep(j,0,K) cout<<dis[i][j]<<" "; cout<<endl; }*/ if(ans==inf) return -1; else return 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:21:13: error: expected ';' before 'double'
   21 | K=min(K,200)
      |             ^
      |             ;
   22 |  double dis[N][K]{};
      |  ~~~~~~      
cyberland.cpp:23:26: error: 'dis' was not declared in this scope; did you mean 'div'?
   23 |  rep(i,0,N) rep(j,0,K+1) dis[i][j]=inf;
      |                          ^~~
      |                          div
cyberland.cpp:26:2: error: 'dis' was not declared in this scope; did you mean 'div'?
   26 |  dis[0][0]=0;
      |  ^~~
      |  div
cyberland.cpp:37:33: error: no matching function for call to 'std::priority_queue<std::array<double, 3>, std::vector<std::array<double, 3> >, std::greater<std::array<double, 3> > >::push(<brace-enclosed initializer list>)'
   37 |      pq.push({k+1,dis[u][k+1],u});
      |                                 ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.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::array<double, 3>; _Sequence = std::vector<std::array<double, 3> >; _Compare = std::greater<std::array<double, 3> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::array<double, 3>]'
  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::array<double, 3>&'}
  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::array<double, 3>; _Sequence = std::vector<std::array<double, 3> >; _Compare = std::greater<std::array<double, 3> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::array<double, 3>]'
  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::array<double, 3>, std::vector<std::array<double, 3> >, std::greater<std::array<double, 3> > >::value_type&&' {aka 'std::array<double, 3>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
cyberland.cpp:44:34: error: no matching function for call to 'std::priority_queue<std::array<double, 3>, std::vector<std::array<double, 3> >, std::greater<std::array<double, 3> > >::push(<brace-enclosed initializer list>)'
   44 |     pq.push({k,dis[v.fi][k],v.fi});
      |                                  ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.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::array<double, 3>; _Sequence = std::vector<std::array<double, 3> >; _Compare = std::greater<std::array<double, 3> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::array<double, 3>]'
  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::array<double, 3>&'}
  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::array<double, 3>; _Sequence = std::vector<std::array<double, 3> >; _Compare = std::greater<std::array<double, 3> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::array<double, 3>]'
  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::array<double, 3>, std::vector<std::array<double, 3> >, std::greater<std::array<double, 3> > >::value_type&&' {aka 'std::array<double, 3>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
cyberland.cpp:48:38: error: no matching function for call to 'std::priority_queue<std::array<double, 3>, std::vector<std::array<double, 3> >, std::greater<std::array<double, 3> > >::push(<brace-enclosed initializer list>)'
   48 |     pq.push({k+1,dis[v.fi][k+1],v.fi});
      |                                      ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.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::array<double, 3>; _Sequence = std::vector<std::array<double, 3> >; _Compare = std::greater<std::array<double, 3> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::array<double, 3>]'
  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::array<double, 3>&'}
  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::array<double, 3>; _Sequence = std::vector<std::array<double, 3> >; _Compare = std::greater<std::array<double, 3> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::array<double, 3>]'
  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::array<double, 3>, std::vector<std::array<double, 3> >, std::greater<std::array<double, 3> > >::value_type&&' {aka 'std::array<double, 3>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
cyberland.cpp:52:34: error: no matching function for call to 'std::priority_queue<std::array<double, 3>, std::vector<std::array<double, 3> >, std::greater<std::array<double, 3> > >::push(<brace-enclosed initializer list>)'
   52 |     pq.push({k,dis[v.fi][k],v.fi});
      |                                  ^
In file included from /usr/include/c++/10/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cyberland.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::array<double, 3>; _Sequence = std::vector<std::array<double, 3> >; _Compare = std::greater<std::array<double, 3> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::array<double, 3>]'
  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::array<double, 3>&'}
  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::array<double, 3>; _Sequence = std::vector<std::array<double, 3> >; _Compare = std::greater<std::array<double, 3> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::array<double, 3>]'
  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::array<double, 3>, std::vector<std::array<double, 3> >, std::greater<std::array<double, 3> > >::value_type&&' {aka 'std::array<double, 3>&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~