Language: C++

#include<cstdio>
#include<queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1e9
using namespace std;
double cost[30][30][31]; int d[30][30],c[30][30],v[30][30][31];
class S{
	double cc;int c,p,v;
	S(double cc,int c,int p,int v):cc(cc),c(c),p(p),v(v){}
	bool operator<(const S &a)const{
		return cc>a.cc;
	}
};
int main(){
	int n,m,s,g,x,y,a,b; double nc;
	while(scanf("%d%d",&n,&m),n){
		scanf("%d%d",&s,&g),s--,g--;
		rep(i,n)rep(j,n){
			rep(k,31)cost[i][j][k]=INF,v[i][j][k]=0;
			d[i][j]=c[i][j]=0;
		}
		rep(i,m)scanf("%d%d%d%d",&x,&y,&a,&b),
		x--,y--,d[x][y]=d[y][x]=a,c[x][y]=c[y][x]=b;
		priority_queue<S> F; F.push(S(0,s,s,0)); cost[s][s][0]=0;
		while(!F.empty()){
			S cs=F.top(); F.pop();
			v[cs.c][cs.p][cs.v]=1;
			if(cs.c==g&&cs.v==1){
				printf("%.5f\n",cs.cc); goto END;
			}
			rep(i,n)if(i!=cs.p&&d[cs.c][i])
			for(int dv=-1;dv<2;dv++)if(!v[i][cs.c][dv+cs.v]&&0<dv+cs.v&&dv+cs.v<=c[cs.c][i]){
				nc=cost[cs.c][cs.p][cs.v]+1.*d[cs.c][i]/(dv+cs.v);
				if(cost[i][cs.c][dv+cs.v]>nc)
				cost[i][cs.c][dv+cs.v]=nc,F.push(S(nc,i,cs.c,dv+cs.v));
			}
		}
		printf("unreachable\n"); END:;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:54: error: 'S::S(double, int, int, int)' is private within this context
   24 |                 priority_queue<S> F; F.push(S(0,s,s,0)); cost[s][s][0]=0;
      |                                                      ^
a.cc:9:9: note: declared private here
    9 |         S(double cc,int c,int p,int v):cc(cc),c(c),p(p),v(v){}
      |         ^
a.cc:27:30: error: 'int S::c' is private within this context
   27 |                         v[cs.c][cs.p][cs.v]=1;
      |                              ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:27:36: error: 'int S::p' is private within this context
   27 |                         v[cs.c][cs.p][cs.v]=1;
      |                                    ^
a.cc:8:25: note: declared private here
    8 |         double cc;int c,p,v;
      |                         ^
a.cc:27:42: error: 'int S::v' is private within this context
   27 |                         v[cs.c][cs.p][cs.v]=1;
      |                                          ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:28:31: error: 'int S::c' is private within this context
   28 |                         if(cs.c==g&&cs.v==1){
      |                               ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:28:40: error: 'int S::v' is private within this context
   28 |                         if(cs.c==g&&cs.v==1){
      |                                        ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:29:52: error: 'double S::cc' is private within this context
   29 |                                 printf("%.5f\n",cs.cc); goto END;
      |                                                    ^~
a.cc:8:16: note: declared private here
    8 |         double cc;int c,p,v;
      |                ^~
a.cc:31:42: error: 'int S::p' is private within this context
   31 |                         rep(i,n)if(i!=cs.p&&d[cs.c][i])
      |                                          ^
a.cc:8:25: note: declared private here
    8 |         double cc;int c,p,v;
      |                         ^
a.cc:31:50: error: 'int S::c' is private within this context
   31 |                         rep(i,n)if(i!=cs.p&&d[cs.c][i])
      |                                                  ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:32:61: error: 'int S::c' is private within this context
   32 |                         for(int dv=-1;dv<2;dv++)if(!v[i][cs.c][dv+cs.v]&&0<dv+cs.v&&dv+cs.v<=c[cs.c][i]){
      |                                                             ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:32:70: error: 'int S::v' is private within this context
   32 |                         for(int dv=-1;dv<2;dv++)if(!v[i][cs.c][dv+cs.v]&&0<dv+cs.v&&dv+cs.v<=c[cs.c][i]){
      |                                                                      ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:32:82: error: 'int S::v' is private within this context
   32 |                         for(int dv=-1;dv<2;dv++)if(!v[i][cs.c][dv+cs.v]&&0<dv+cs.v&&dv+cs.v<=c[cs.c][i]){
      |                                                                                  ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:32:91: error: 'int S::v' is private within this context
   32 |                         for(int dv=-1;dv<2;dv++)if(!v[i][cs.c][dv+cs.v]&&0<dv+cs.v&&dv+cs.v<=c[cs.c][i]){
      |                                                                                           ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:32:99: error: 'int S::c' is private within this context
   32 |                         for(int dv=-1;dv<2;dv++)if(!v[i][cs.c][dv+cs.v]&&0<dv+cs.v&&dv+cs.v<=c[cs.c][i]){
      |                                                                                                   ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:33:44: error: 'int S::c' is private within this context
   33 |                                 nc=cost[cs.c][cs.p][cs.v]+1.*d[cs.c][i]/(dv+cs.v);
      |                                            ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:33:50: error: 'int S::p' is private within this context
   33 |                                 nc=cost[cs.c][cs.p][cs.v]+1.*d[cs.c][i]/(dv+cs.v);
      |                                                  ^
a.cc:8:25: note: declared private here
    8 |         double cc;int c,p,v;
      |                         ^
a.cc:33:56: error: 'int S::v' is private within this context
   33 |                                 nc=cost[cs.c][cs.p][cs.v]+1.*d[cs.c][i]/(dv+cs.v);
      |                                                        ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:33:67: error: 'int S::c' is private within this context
   33 |                                 nc=cost[cs.c][cs.p][cs.v]+1.*d[cs.c][i]/(dv+cs.v);
      |                                                                   ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:33:80: error: 'int S::v' is private within this context
   33 |                                 nc=cost[cs.c][cs.p][cs.v]+1.*d[cs.c][i]/(dv+cs.v);
      |                                                                                ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:34:47: error: 'int S::c' is private within this context
   34 |                                 if(cost[i][cs.c][dv+cs.v]>nc)
      |                                               ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:34:56: error: 'int S::v' is private within this context
   34 |                                 if(cost[i][cs.c][dv+cs.v]>nc)
      |                                                        ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:35:44: error: 'int S::c' is private within this context
   35 |                                 cost[i][cs.c][dv+cs.v]=nc,F.push(S(nc,i,cs.c,dv+cs.v));
      |                                            ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:35:53: error: 'int S::v' is private within this context
   35 |                                 cost[i][cs.c][dv+cs.v]=nc,F.push(S(nc,i,cs.c,dv+cs.v));
      |                                                     ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:35:76: error: 'int S::c' is private within this context
   35 |                                 cost[i][cs.c][dv+cs.v]=nc,F.push(S(nc,i,cs.c,dv+cs.v));
      |                                                                            ^
a.cc:8:23: note: declared private here
    8 |         double cc;int c,p,v;
      |                       ^
a.cc:35:84: error: 'int S::v' is private within this context
   35 |                                 cost[i][cs.c][dv+cs.v]=nc,F.push(S(nc,i,cs.c,dv+cs.v));
      |                                                                                    ^
a.cc:8:27: note: declared private here
    8 |         double cc;int c,p,v;
      |                           ^
a.cc:35:85: error: 'S::S(double, int, int, int)' is private within this context
   35 |                                 cost[i][cs.c][dv+cs.v]=nc,F.push(S(nc,i,cs.c,dv+cs.v));
      |                                                                                     ^
a.cc:9:9: note: declared private here
    9 |         S(double cc,int c,int p,int v):cc(cc),c(c),p(p),v(v){}
      |         ^
In file included from /usr/include/c++/14/bits/refwrap.h:39,
                 from /usr/include/c++/14/deque:67,
                 from /usr/include/c++/14/queue:62,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = S]':
/usr/include/c++/14/bits/predefined_ops.h:196:23:   required from 'bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<S*, std::vector<S, std::allocator<S> > >; _Value = S; _Compare = std::less<S>]'
  196 |         { return bool(_M_comp(*__it, __val)); }
      |                       ~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:140:48:   required from 'void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<S*, vector<S, allocator<S> > >; _Distance = long int; _Tp = S; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<S> >]'
  140 |       while (__holeIndex > __topIndex && __comp(__first + __parent, __value))
      |                                          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:216:23:   required from 'void std::push_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<S*, vector<S, allocator<S> > >; _Compare = less<S>]'
  216 |       std::__push_heap(__first, _DistanceType((__last - __first) - 1),
      |       ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  217 |                        _DistanceType(0), _GLIBCXX_MOVE(__value), __cmp);
      |