WA in WSITES01(Blocked Sites)

I solved the question using trie and set, however got WA on two cases in subtask 2. Here is the solution. If someone could point out the error or provide certain test case(s), it would be great help. Thanks in advance.

input:

4
+ google
+ googld
- goog
- googles

output:

-1
1 Like

https://www.codechef.com/viewsolution/13633491

i am getting WA in two test case …plz help me …

@hikarico
Why isnt the answer for the above test case “googles”?

I am getting WA.Can anyone post what is wrong in my solution.Here is my solution.If someone could point out the error or provide certain test case(s), it would be great help. Thanks in advance.

can you please check mine … its passing all the above test cases … please let me know where it went wrong.
i made two seperate arrays for blocked and unblocked and then solved this one…
[solution][1]
[1]: CodeChef: Practical coding for everyone
(sorry i cant post a question yet… so asking here)

My code passes all cases except 2. Can someone please explain what i have done wrong. I used a very naive approach of sorting the strings and applying binary search to find the closest +ve string …
my_solution: CodeChef: Practical coding for everyone

Hi I have tried a lot … but 2 TCs area failing…
https://www.codechef.com/viewsolution/14405914
I checked all the below TCs all are passing . Could somebody please help me in this…

//If all positive strings Output should be : 0

4
+ youtube
+ abcd
+ abcdchef
+ zzyy
Output
0

//// all negative

5
- abcdchef
- youtube
- youtubeisbest
- google
- googled
Output :
3
a
g
y
/// show strings in sorted order
6
+ google
+ googld
- googles
- googlea
- googlds
- googldr
OUTPUT :
4
googldr
googlds
googlea
googles
//////Any mathched -ve string shorter then positive
4
+ google
+ googld
- goog
- googles
OUTPUT :
-1
////Any mathched +ve string Longer then negative
3
- goog
- googles
+ google
OUTPUT :
-1

//same string

2
- abc
+ abc
OUTPUT
-1

I misunderstood the question. Thanks!

If you write just googles then goog will be missing.

@devilhector can you explain me if you understood the above test case.
Even I have those 2 test cases wrong.

You need to block all minuses. Answer is -1 because there’s no way to block goog without blocking google and googld

input

3
+ google
+ googld
- googles

output should be

1
googles

but you’re outputing

1
google

1 karma users can ask questions here-

https://discuss.codechef.com/questions/97820/i-want-to-ask-a-question-ask-them-all-here

@mayank_code you need to answer prefixes that block all ‘-’ but are not prefixes of any ‘+’ or unblocked sites.

add spaces in the testcase then it gives right answer.
4

  • a
  • ab
  • abc
  • acde

Noted, thanks for indicating that. Will come up with fresh test case soon :slight_smile: