You are not logged in. Please login at www.codechef.com to post your questions!

×

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.

This question is marked "community wiki".

asked 19 May, 03:23

devilhector's gravatar image

3★devilhector
384
accept rate: 12%

edited 19 May, 04:21


input:

4 + google + googld - goog - googles

output:

-1

link

answered 19 May, 10:47

hikarico's gravatar image

6★hikarico
1.7k414
accept rate: 26%

I misunderstood the question. Thanks!

(19 May, 15:46) devilhector3★

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

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

link

answered 19 May, 11:37

sidd845's gravatar image

4★sidd845
254
accept rate: 0%

input

3
+ google
+ googld
- googles

output should be

1
googles

but you're outputing

1
google
(19 May, 21:31) hikarico6★

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

link

answered 19 May, 16:40

mayank_code's gravatar image

3★mayank_code
1
accept rate: 0%

If you write just googles then goog will be missing.

(19 May, 16:44) shraeyas2★

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

(19 May, 20:42) mayank_code3★

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

(19 May, 21:26) hikarico6★

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

(20 May, 03:31) devilhector3★

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.

link

answered 19 May, 22:53

jayaprakash21's gravatar image

3★jayaprakash21
11
accept rate: 0%

add spaces in the testcase then it gives right answer. 4 + a
+ ab + abc - acde

(20 May, 12:22) jayaprakash213★

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

(20 May, 12:44) vijju123 ♦5★

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

link

answered 20 May, 01:28

code_harsh's gravatar image

2★code_harsh
1
accept rate: 0%

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: https://www.codechef.com/viewsolution/13495612

link

answered 20 May, 10:17

dnmehta's gravatar image

3★dnmehta
1
accept rate: 0%

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
link

answered 04 Jul, 15:27

xamitksx's gravatar image

2★xamitksx
11
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×827
×18

question asked: 19 May, 03:23

question was seen: 527 times

last updated: 04 Jul, 15:27