Блог пользователя CrypticTaiga

Автор CrypticTaiga, история, 4 года назад, По-английски

Problem — Problem

Submission — My Submission

I tried to solve the problem by taking the calculating the costs from all indexes starting from 0 upto n-1, and finally comparing the cost with the value of p. This is failing for large testcases (like number 5) and I am getting TLE.

Can you help me figure out how to make a dp array to save the precalculated costs for a prefix of length i at index i and then use to to calculate the cost for the prefix of size (i + 1). I tried but mine approach is not working correctly.

Thanks!

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

Автор CrypticTaiga, история, 4 года назад, По-английски

Problem — Nastya and Scoreboard

My submission — Cryptic Taiga's Submission

I figured out a way to solve this problem. First I saved the number of changes needed to be made in each input string/digit to a digit from 0-9 in the array changes[][]. Next, I filled up the dp[][][] array with 0, 1 depending upon if this path leads to the maximum obtainable number as per the requirement of the question.

But, somehow i am getting TLE in the testcase 7.

Please help solving and correcting my submission.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится