Language: C++


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for( ll (i)=0; (i)<(n); ++(i) )
#define rpv(d) for(auto& v:d)
#define co(n) cout << (n) << endl;
#define cn(n) cin >> n;
#define all(x) (x).begin(), (x).end()

int main(){
  int v,e; cin >> v >> e;
  vector<tuple<int,int,int>> edge(e);
  vector<int> f(v);
  vector<vector<int>> fx(v,vector<int>(v));
  vector<vector<int>> fd(v,vector<int>(v));
  rep(i,v){rep(j,v){if (i!=j){fx[i][j]=INT32_MAX;}else{fx[i][j]=0;}}}
  rpv(edge){
    cin>>get<0>(v)>>get<1>(v)>>get<2>(v);
    fx[get<0>(v)][get<1>(v)]=get<2>(v);
    fd[get<0>(v)][get<1>(v)]=get<1>(v);
  }
  rep(k,v){
    rep(i,v){
      rep(j,v){
        if ( fx[i][k] + fx[k][j] < fx[i][j] ){
          fx[i][j] = fx[i][k] + fx[k][j];
          fd[i][j] = fd[i][k];
        }
      }
    }
  }
  rpv(f){cn(v)}
  int t_max; cin >> t_max;
  struct order{
    int dst;
    int t;
    bool sw = false;
  };
  order odr[9501];
  list<int> dst;
  struct {
    int from = 0;
    int to;
    int dst = 0;
  } car;
  rep(t,t_max){
    int n;cn(n)
    rep(i,n){
      int id,dst; cn(id)
      cn(odr[id].dst)
      odr[id].t=t;
      odr[id].sw=true;
    }
    cn(n)
    rep(i,n){
      int id;cn(id)
      dst.push_back(odr[id].dst);
      odr[id].sw=false;
    }
    //
    if (dst.empty()&&car.from==0){
      puts("-1");
    }else{
      if (dst.empty())dst.push_back(0);
      if (car.dst){
        co(min( fx[dst.front][car.from] , fx[dst.front][car.to] ))
        ++car.dst;
        if (car.dst==fx[car.from][car.to]){
          //dst.remove_if([&](int x){return x==car.to;});
          car.from=car.to;car.dst=0;
        }
      }else{
        dst.remove_if([&](int x){return x==car.from;});
        co(fd[car.from][dst.front])
        car.to=fd[car.from][dst.front];
        ++car.dst;
      }
    }
    //
    string s;cn(s)
    if (s=="NG")break;
    cn(n)rep(i,n){
      int id;cn(id)
      odr[id].t=false;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:68:19: error: no match for 'operator[]' (operand types are 'std::vector<std::vector<int> >' and '<unresolved overloaded function type>')
   68 |         co(min( fx[dst.front][car.from] , fx[dst.front][car.to] ))
      |                   ^
a.cc:8:24: note: in definition of macro 'co'
    8 | #define co(n) cout << (n) << endl;
      |                        ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; reference = std::vector<int>&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; const_reference = const std::vector<int>&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:68:45: error: no match for 'operator[]' (operand types are 'std::vector<std::vector<int> >' and '<unresolved overloaded function type>')
   68 |         co(min( fx[dst.front][car.from] , fx[dst.front][car.to] ))
      |                                             ^
a.cc:8:24: note: in definition of macro 'co'
    8 | #define co(n) cout << (n) << endl;
      |                        ^
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; reference = std::vector<int>&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; const_reference = const std::vector<int>&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:76:24: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} and '<unresolved overloaded function type>')
   76 |         co(fd[car.from][dst.front])
      |                        ^
a.cc:8:24: note: in definition of macro 'co'
    8 | #define co(n) cout << (n) << endl;
      |                        ^
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
a.cc:77:28: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} and '<unresolved overloaded function type>')
   77 |         car.to=fd[car.from][dst.front];
      |                            ^
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]'
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1128:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1147:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::operator[](size_type) const [with _Tp = int; _Alloc = std::allocator<int>; const_reference = const int&; size_type = long unsigned int]'
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1147:28: note:   no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::vector<int>::size_type' {aka 'long unsigned int'}
 1147 |       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
      |                  ~~~~~~~~~~^~~