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

Автор aman_naughty, история, 5 лет назад, По-английски

Problem Link : link

code link : code

In the bfs part I am extracting nodes at a given level and then in help function I am greedily sorting the CT and TT by CT time in acsending order as we want the developer to finish the module code asap so that the tester can attend to it. Also I believe that it doesn't matter if we process level 1 first and then subsequent levels as I am adding the time of each level to my answer. Why is this code giving WA. Any help is appreciated.

P.S- No one was able to solve this problem in the contest and thus it seems an interesting problem.

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

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

Link for your code is private. Can you share it through ideone or pastebin?

»
5 лет назад, # |
  Проголосовать: нравится +13 Проголосовать: не нравится

I don't fully understand your explanation. By level you mean some depth (distance from the root)? We shouldn't group by that. The problem looks like bottom-up dp on tree.

If you don't know why your solution is wrong, write a brute force and compare them on random tests. More info: Asking for help FAQ.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Yes by level I mean depth.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Can you please tell if the code to solve the subproblem is correct or not.

      Sub problem: given developer time array and tester time array find minimum time to completely develop and test all modules and tester can only test a module provided developer has coded it.

      My approach : Sort both arrays according to developer time in increasing order because we want to develop modules asap so that the tester can test it asap. Can you provide a counter case where my approach fails . Here is the code I am taling about.

      code

      d array is for developer and t array is for tester and a array is just storing the pairs of developer tester time for facilitating sorting.