# 9697724 | CodeChef (having problem in the truth and dare beginner question)

problem : TRUEDARE Problem - CodeChef
my solution to the problem: CodeChef: Practical coding for everyone

the logic i used:-
if(ts>tr) or if(ds>dr)
i put the value of flag to 0 which indicates that shyam will win( since he can ask some things that ram cannot do) (flag being 1 indicates that ram will win)
if that if case fails, i used linearsearch function to search every true value that shyam can ask is present in the tr array or not ( the array containing the tasks ram can do)
same logic with dare array.

the OUTPUT seems to be correct when i run it on ide of codechef but it still says WA ???
thank you for your help guys

Your solution is not correct as any array may contain duplicates.

Suppose t1 = {1, 2}, t2 = {1, 2, 2}, d1 = {1}, d2 = {1, 1, 1};

In this case, your code will output “no” but the answer is “yes”.

I have commented incorrect code in this submission.
https://www.codechef.com/viewsolution/33533449

And you can use sets instead of linearsearch…

thank you so much! this was really helpful