problem link WSITES01
myCode Link
My code is giving Correct Answer for all test cases Cheked by me but it is not passing all cases for codechef
i tried a lot to found where my code is failing but dont know why
plz help me
problem link WSITES01
myCode Link
My code is giving Correct Answer for all test cases Cheked by me but it is not passing all cases for codechef
i tried a lot to found where my code is failing but dont know why
plz help me
Check this one:
3
I believe it fails here-
Input
4
+ hackerrank
- hackerrankz
+ ae
- a
Output
1
hackerrankz
Expected Output
-1
I believe that we have to include “ae” but block “a”, but “a” is a prefix of “ae”, so its not possible to block all bad sites without blocking a good one. So we print -1.
@vijju123 i am sure… u havn’t submitted this question till now… output will be -1 when no filter is created… here hackerrankz filter is created so output will 1
No dear, i cross-checked it with correct programs. The output is -1.
Here is what Q said-
If it is not possible to choose set of filters and satisfy all constraints, output a single line containing an integer -1.
And constraints were-
A filter is a string that should be a prefix of some blocked site, and it should not be a prefix of any unblocked site
You cannot block “a” without blocking “ae”
Yes, try giving it a shot with this in mind
No problem