Codeforces Round 1133 (Div. 1, Div. 2) is coming soon! Register here. ×

CarViz's blog

By CarViz, history, 9 months ago, In English

wait genuinely it says it fails test 4 but when I run it on test 4 manually it passes

359461785

  • Vote: I like it
  • +2
  • Vote: I do not like it

»
9 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

i changed it to python instead of pypy and it works now (fails test 120) but im not sure why it failed with pypy.

  • »
    »
    9 months ago, hide # ^ |
    ← Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    first of all you are trying to allocate an array of length k

    which in worst case can be 1e9 so there it will cause runtime error as this allocation memory is not possible

    now coming to wrong answer:

    because you are storing l as set itself, the order can be random

    for example:

    case:

    1

    3 6

    2 4 6

    here if the set generates the order 6 4 2

    then the code will print

    3

    6 4 2

    which is not minimal because it should be 2 4 6 and then then

    1

    2

    should be the output

    so that is why on some inputs the set's order is not giving the minimum so that is why it is failing

    and anyways it will not pass the worst case because of memory error as I explained above

    and also it should not pass in python or pypy both, it will fail in both the environments.