1137C. Museums Tour: WA79 again and again [FIXED]

Revision en2, by dmkz, 2019-03-14 20:01:05

Hi, I cant understand, why my solution to problem 1137C. Museums Tour is getting WA79. Testcase is large, I tried to found by brute force on small graphs for n <= 4 and d <= 4 and compare with other accepted solutions and did not found counter-test. Can anybody help with understanding why my solution got WA79?

UPD. Fixed. Looks like we can't use dynamic programming on topological order, where we will update dp like: dp[next] = std::max(dp[next], dp[curr] + value[next]) for all edges curr->next, we only allowed use dynamic programming like dp[curr] = std::max(dp[curr], dp[prev]+value[curr]) for all edges prev->curr. Accepted try, difference with wa79.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English dmkz 2019-03-14 20:01:05 469
en1 English dmkz 2019-03-14 13:17:02 460 Initial revision (published)