Random input, what a nifty feature!
Now I have something to work with, thanks a lot.
Search found 5 matches
- Thu Oct 09, 2014 11:09 pm
- Forum: Volume 116 (11600-11699)
- Topic: 11635 - Hotel booking
- Replies: 39
- Views: 11100
- Thu Oct 09, 2014 1:29 am
- Forum: Volume 116 (11600-11699)
- Topic: 11635 - Hotel booking
- Replies: 39
- Views: 11100
Re: 11635 - Hotel booking
Think there must be an error in your AC output (should be one). The following path can be taken with one hotel stay: 1 - 6 STAY 6 - 10 - 4 - 17 -3 - 19.
By the way thanks to all of you for taking some of your time to help me out. Really appreciated.
By the way thanks to all of you for taking some of your time to help me out. Really appreciated.
- Wed Oct 08, 2014 3:33 pm
- Forum: Volume 116 (11600-11699)
- Topic: 11635 - Hotel booking
- Replies: 39
- Views: 11100
Re: 11635 - Hotel booking
My approach is to perform a bfs-search from the first node and visit all nodes I can visit without violating the time constraint. All nodes encountered containing a hotel are added to a queue and if the final node is reached the algorithm terminates. Once no more nodes can be reached a new bfs-searc...
- Wed Oct 08, 2014 2:30 pm
- Forum: Volume 116 (11600-11699)
- Topic: 11635 - Hotel booking
- Replies: 39
- Views: 11100
Re: 11635 - Hotel booking
I always (in the code) visit a city if it can be reached in less time than any of the previous visits during the same day or if it hasn't been visited yet. This cover all cases I can think of. I get the correct output for all testcases in this thread but WA when I submit 

- Wed Oct 08, 2014 10:56 am
- Forum: Volume 116 (11600-11699)
- Topic: 11635 - Hotel booking
- Replies: 39
- Views: 11100
Re: 11635 - Hotel booking
I'm getting wrong answer, but can't seem to find the problem. Does anyone have a hint or suggestion what to take a closer look at? #include <iostream> #include <vector> #include <queue> using namespace std; struct edge { int d,t; edge(int din,int tin): d(din), t(tin){}; }; struct node { bool hotel,h...