AARYABHATTA_THE_GREAT's blog

By AARYABHATTA_THE_GREAT, history, 3 days ago, In English

Can Someone please help me out with optimizing my solution?

Question Link -> https://codeforces.net/contest/2037/problem/G

My Solution -> https://codeforces.net/contest/2037/submission/298945671

Its obvious what I am trying to do. I simply create DAG by adding edges between indexes where transition is possible. Then I run Kahn's algo to sort the nodes and then its simple dp to find number of ways to reach the ending node.

  • Vote: I like it
  • -9
  • Vote: I do not like it