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

×

# Help needed in Binary Matrix CF 884F

 1 Hello, I am facing WA in test 7 in problem Binary Matrix. Here's my submission. Can anyone tell me what is wrong in my solution, or provide helpful test cases? asked 16 Jul '18, 16:27 3.9k●23●87 accept rate: 22% Can Anyone help?? (16 Jul '18, 20:11) anyone?? (18 Jul '18, 14:07)

10 4
B
9
D
5
D
B
9
D
5
7

1011
1001
1101
0101
1101
1011
1001
1101
0101
0111

# Expected Output: 1

## Your output : 2

You have logical error probably....

answered 18 Jul '18, 16:53

1.4k19
accept rate: 25%

will reply error soon... I guess its related to conflicting roots or something of that type... let me check it thoroughly...
I made this test case after reading your logic...

(18 Jul '18, 16:56)
1

## GOT ERROR

check set after
2 4
D
5

i.e.
1101
0101

so after D
set[0-3] becomes :
0012

and then you will assign
4567 to set[4-7] for 5

now for union query
union(set,3,7)

You will do find(3)
set[3]=find(set[3)) = find(2)
find(2)
set[2]=find(set[2))= find(0)
set[0]=0

so basically all will point to zero i.e set[0-3]=0000 ... which was not intended... it should remain 0012 no matter what you do...

(18 Jul '18, 17:37)

as I said earlier it's about conflicting and wrong assignment of value to root... Due to uniq function...

(18 Jul '18, 17:39)
1

Thanks a lot for test case, let me try debugging. Will ping here if can't debug.

(18 Jul '18, 17:39)

sure... welcome :)

(18 Jul '18, 17:57)
 1 https://ideone.com/CcizLE ur code gives output 4 for this test case : : 3 16 9CFD E9A7 9BAF answer should be 3 hope this helps , as i don't know java so i cant figure out the bug .. answered 18 Jul '18, 16:14 75●6 accept rate: 0% 1 try this one too :: 10 24 174094 882455 171152 761423 221685 761892 795431 233411 387427 793198 (18 Jul '18, 17:01) Thanks for test cases, man. (18 Jul '18, 17:40)
 toggle preview community wiki:
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:

×2,701
×658
×66

question asked: 16 Jul '18, 16:27

question was seen: 211 times

last updated: 18 Jul '18, 17:57