Submission #752429

# Submission time Handle Problem Language Result Execution time Memory
752429 2023-06-03T03:03:51 Z bachhoangxuan Cyberland (APIO23_cyberland) C++17
Compilation error
0 ms 0 KB
#include "cyberland.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define pdi pair<double,pii>
#define fi first
#define se second
 
double solve(int N, int M, int K, int T, std::vector<int> x, std::vector<int> y, std::vector<int> c, std::vector<int> arr) {
    K=min(K,100);
    vector<vector<double>> dist(N,vector<double>(K+1,1e14));
    vector<vector<pii>> edge(N);
    for(int i=0;i<M;i++){
        edge[x[i]].push_back({y[i],c[i]});
        edge[y[i]].push_back({x[i],c[i]});
    }
    priority_queue<pdi,vector<pdi>,greater<pdi>> pq;
    dist[0][0]=0;pq.push({0,{0,0}});
    while(!pq.empty()){
        auto [d,x]=pq.top();pq.pop();
        int u=x.fi,k=x.se;
        if(u==T) return d;
        if(k==K) continue;
        for(auto [v,w]:edge[u]){
            double nd=dist[u][k]*(arr[v]?1.0/arr[v]:0)+w;
            int nk=k+(arr[v]==2);
            if(dist[v][nk]>nd){
                dist[v][nk]=nd;
                pq.push({nd,{v,nk}});
            }
            if(dist[u][k]+w<dist[v][k]){
                dist[v][k]=dist[u][k]+w;
                pq.push({dist[u][k]+w,{v,k}});
            }
        }
    }
    return -1;
}

Compilation message

cyberland.cpp:25:2: error: extended character   is not valid in an identifier
   25 |             double nd=dist[u][k]*(arr[v]?1.0/arr[v]:0)+w;
      |  ^
cyberland.cpp:25:5: error: extended character   is not valid in an identifier
   25 |             double nd=dist[u][k]*(arr[v]?1.0/arr[v]:0)+w;
      |    ^
cyberland.cpp:25:8: error: extended character   is not valid in an identifier
   25 |             double nd=dist[u][k]*(arr[v]?1.0/arr[v]:0)+w;
      |      ^
cyberland.cpp:25:11: error: extended character   is not valid in an identifier
   25 |             double nd=dist[u][k]*(arr[v]?1.0/arr[v]:0)+w;
      |        ^
cyberland.cpp:25:14: error: extended character   is not valid in an identifier
   25 |             double nd=dist[u][k]*(arr[v]?1.0/arr[v]:0)+w;
      |          ^
cyberland.cpp:25:17: error: extended character   is not valid in an identifier
   25 |             double nd=dist[u][k]*(arr[v]?1.0/arr[v]:0)+w;
      |            ^
cyberland.cpp: In function 'double solve(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
cyberland.cpp:25:2: error: '\U000000a0' was not declared in this scope
   25 |             double nd=dist[u][k]*(arr[v]?1.0/arr[v]:0)+w;
      |  ^
cyberland.cpp:27:28: error: 'nd' was not declared in this scope; did you mean 'nk'?
   27 |             if(dist[v][nk]>nd){
      |                            ^~
      |                            nk
cyberland.cpp:29:36: error: no matching function for call to 'std::priority_queue<std::pair<double, std::pair<int, int> >, std::vector<std::pair<double, std::pair<int, int> > >, std::greater<std::pair<double, std::pair<int, int> > > >::push(<brace-enclosed initializer list>)'
   29 |                 pq.push({nd,{v,nk}});
      |                                    ^
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:2:
/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<double, std::pair<int, int> >; _Sequence = std::vector<std::pair<double, std::pair<int, int> > >; _Compare = std::greater<std::pair<double, std::pair<int, int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<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<double, std::pair<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<double, std::pair<int, int> >; _Sequence = std::vector<std::pair<double, std::pair<int, int> > >; _Compare = std::greater<std::pair<double, std::pair<int, int> > >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<double, std::pair<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<double, std::pair<int, int> >, std::vector<std::pair<double, std::pair<int, int> > >, std::greater<std::pair<double, std::pair<int, int> > > >::value_type&&' {aka 'std::pair<double, std::pair<int, int> >&&'}
  648 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~