Canadian Computing Olympiad: 2015 Day 1, Problem 2
There are many well-known algorithms for finding the shortest route from one location to another. People have GPS devices in their cars and in their phones to show them the fastest way to get where they want to go. While on vacation, however, Troy likes to travel slowly. He would like to take the longest route to his destination so that he can visit many new and interesting places along the way.
As such, a valid route consists of a sequence of distinct cities,
He does not want to visit any city more than once. Can you help him find the longest route?
Input Specification
The first line of input contains two integers
The next
For at least 30% of the marks for this problem,
Output Specification
Output a single integer, the length of the longest route that starts in city
Sample Input
3 3
0 2 5
0 1 4
1 2 3
Output for Sample Input
7
Explanation of Output for Sample Input
The shortest route would be to take the road directly from
Comments
Troy: wants longest route
gas prices now: NO
This comment is hidden due to too much negative feedback. Show it anyway.
Copies from geeks for geeks - https://dmoj.ca/src/4418660
Complains the question is impossible
Copies from Github - https://dmoj.ca/src/4418706
Proceeds to solve 40pp IOI problems effortlessly
This comment is hidden due to too much negative feedback. Show it anyway.
jorgebean, you've been a sussy baka
Not gonna lie, to me that sounds a bit...
...farfetch'd
effortlessly.
https://en.wikipedia.org/wiki/Gaslighting
You made that article up.
preach king
Given that more than
people have solved this question, I doubt the test cases (or intended solutions) are wrong. If you have a specific issue with your code, you can ask for help in the DMOJ Discord server.
The only impossible task is me winning your heart 😫😵
is this graph acyclic
Given the contraints that
can be 
(which is that every city has a road to every other city), probably no.
I just figured out that the title is Dijkstra backwards lol
Can this problem be solved in polynomial time?
No. (assuming that P is not NP)
Most likely no, since all the submissions to this problem are in exponential time.
Edit: I'm stupid and thought exponential time was polynomial.
TFW you think the roads aren't one-directional
TFW you read this comment and still make the same mistake
I just read those two comments and my muscle memory instantly made those roads bi-directional...