Language: C++

# 2 "2298.cpp"
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <iterator>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>

namespace algorithm {
   using namespace std;

   template <class TNode>
   class IBFS {
   private:
      queue <TNode> Q;
      virtual void init() = 0;
      virtual TNode get_start_node() = 0;
      virtual bool is_goal_node( TNode node ) = 0;
      virtual void find_next_node( TNode node ) = 0;
   public:
      IBFS() {
         Q = queue <TNode>();
      }
      TNode run() {
         init();
         Q.push( get_start_node() );
         while ( ! Q.empty() ) {
            TNode node = Q.front();
            Q.pop();
            if ( is_goal( node ) ) {
               return node;
            }
            find_next_node( node );
         }
         return TNode();
      }
      void push_next_node( TNode node ) {
         Q.push(node);
      }
   };
}


namespace solution {
   using namespace std;
   using namespace algorithm;

   typedef istringstream ISS;
   typedef ostringstream OSS;
   typedef vector<string> VS;
   typedef long long LL;
   typedef int INT;
   typedef vector<INT> VI;
   typedef vector<VI> VVI;
   typedef pair<INT, INT> II;

   const int SIZE = 201;
   const int MAX_LENGTH = 10001;
   const int NONE = -1.0;
   const double EPS = 1e-9;
   int N;
   int K;
   int T;
   int U;
   int V;
   int L;
   bool D[MAX_LENGTH];


   bool lessthan_equal( double a, double b ) {
      if ( fabs( a - b ) < EPS ) return true;
      return a < b;
   }

   class Solution {
   private:

      class Node {
      public:
         double cost;
         int id;
         int remains;
         int carrots;
         Node(): cost(NONE){}
         Node( double cost, int id, int remains, int carrots ):
            cost(cost), id(id), remains(remains), carrots(carrots) {}
         friend ostream& operator << ( ostream& os, Node node ) {
            return os << node.cost << ", " << node.id << ", "
                      << node.remains << ", " << node.carrots << " / ";
         }
      };

      class BFS: public IBFS<Node> {
      private:
         double base;
         double fast;

         void init() {
            base = 1.0 / U;
            fast = 1.0 / V;
         }

         Node get_start_node() {
            return Node( 0.0, 0, 0, 0 );
         }

         bool is_goal_node( Node node ) {
            return node.id == L;
         }

      public:

         void find_next_node( Node node ) {
            Node next_node = node;

            if ( D[next_node.id] ) {
               if ( next_node.carrots == K ) {
                  next_node.remains = T * V;
               } else {
                  next_node.carrots ++;
                  if ( next_node.remains == 0 ) {
                     next_node.remains = T * V;
                     next_node.carrots --;
                  }
               }
            }

            double t = base;
            if ( next_node.remains ) {
               t = min( t, fast );
               next_node.remains --;
            }
            if ( next_node.remains == 0 && next_node.carrots ) {
               next_node.remains = T * V;
               next_node.carrots --;
            }
            next_node.cost += t;
            next_node.id += 1;

            push_next_node( next_node );
         }
      };

      void init() {
         for ( int i = 0; i < MAX_LENGTH; ++ i ) {
            D[i] = false;
         }
      }

      bool input() {
         if ( ! ( cin >> N >> K >> T >> U >> V >> L ) ) return false;
         for ( int i = 0; i < N; ++ i ) {
            int d;
            cin >> d;
            D[d] = true;
         }
         return true;
      }

      double solve() {
         static BFS bfs;
         bfs = BFS();
         return bfs.run().cost;
      }

   public:
      int run() {
         while ( init(), input() ) {
            printf( "%.9f\n", solve() );
         }
         return 0;
      }
   };
}

int main() {
   using namespace solution;
   Solution s;
   return s.run();
}

Compiler output:
2298.cpp: In instantiation of 'TNode algorithm::IBFS<TNode>::run() [with TNode = solution::Solution::Node]':
2298.cpp:176:24:   required from here
2298.cpp:43:25: error: 'is_goal' was not declared in this scope