I am able to pass 1 test case out of 2 ,not able to recognise where my approach is wrong
I have tried to use topololgical sort with a priority queue.
link to my code is–https://ide.codingblocks.com/s/77408
Doubt in -- Vivek and Party
6
A
B
C
D
E
F
6
A D
D E
A B
B C
C F
E F
your code outputs A B C D E F
correct output A D E B C F because there is no relation between B and D and D comes first in the input so D must be placed before B.
sir but b is coming earlier in input (2nd place) nd d is at(4th place) so b should come eralier i guess so my output is correct i think.pls correct me if wrong.
sory i provided you wrong test cases
check this
6
a
b
c
d
e
f
1
a b
your output a b
your should consume all the drinks.
i have fixed it for the strings which were not included in the output by maintaining the strings given in comparison list but still my code is giving wrong answer.
i have fixed it for the strings which were not included in the output by maintaining the strings given in comparison list but still my code is giving wrong answer. nd link to my code is–https://ide.codingblocks.com/s/77650. nd k is greater than 0 always given in constraints.
sir i was getting wrong answer for test case 1 so i downloaded the test case and on downloading i found the test case ans to be matching with my output on running it on ur ide.
sir i was getting wrong answer for test case 1 so i downloaded the test case and on downloading i found the test case ans to be matching with my output on running it on ur ide. test case is–5 A B C D E 5 C A D A B D E B E C nd output is E B C D A then why on submitting it it is giving me wrong ans for test case 1
are you getting wa for both test case or only 1st ?