#ifndef __PROGTEST__ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #endif /* __PROGTEST__ */ // https://fit-wiki.cz/%C5%A1kola/p%C5%99edm%C4%9Bty/bi-pa2/pa2_zkou%C5%A1ka_2023-05-25 class CTeleport { public: CTeleport() {} ~CTeleport() {} enum City : int {}; enum Time : int {}; struct Port { public: Port( City to, Time fromTime, Time toTime ) : to(to), fromTime(fromTime), toTime(toTime) {} City to; Time fromTime; Time toTime; bool operator<( const Port& oth ) const { return std::tie(fromTime, toTime, to) < std::tie(oth.fromTime, oth.toTime, oth.to); } }; //---------------------------------------------------------------------------- CTeleport & Add ( const string & from, const string & to, unsigned fromTime, unsigned toTime ) { auto it1 = _toInt.try_emplace(from, City(_toInt.size())); if (it1.second) _ports.emplace_back(); auto it2 = _toInt.try_emplace(to, City(_toInt.size())); if (it2.second) _ports.emplace_back(); _ports[ it1.first->second ].emplace(it2.first->second, Time(fromTime), Time(toTime)); return *this; } //---------------------------------------------------------------------------- CTeleport & Optimize ( void ) { // todo return *this; } //---------------------------------------------------------------------------- unsigned FindWay( const string & from, const string & to, unsigned time ) { std::queue q; std::vector