Slightly weak tests on this problem:
Input:
4 6 4
1 2
1 3
1 4
3 1 4 2 1 1
2 2 2
1 3 1 3
1 2 1 1
1 2 1 1
Output:
3 1 2 5
1 6
1 4
P.S. I am not blaming anyone. Sometimes this kind of thing inevitably happens. I just wanted to let others know that their solution might be incorrect.
From the statement: As a result he picks at most k best girls he still have not invited from junctions on his way and invites them to his house to test if one of them is his dream girl. If there are less than k not invited girls on his path, he invites all of them.
At the time of the first query of type 1, he still hasn't invited any girl, so he invites girls #1, #2, #5. Then those are already invited, girl #6 has less weight than girl #4, so he now invites her, and afterwards he invites girl #4. The output seems correct to me..
What output did you expect? since my solution gives the same as thr one written on your post
Yeah, I meant this was a correct output, but some "accepted" solutions crash on this test. For example, look at this code.
Actually, The testcases of problems sometimes are incomplete. I remember that one of my program can pass the test in Codeforces, but in another OJ it failed to pass because of some boundary testdatas.
Thanks for pointing out my mistake. And here is my new submission 20498917.