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

×

STRINGRA Please help in debugging

link text

I have tried very much to debug my code yet i am not able to do so. Please help in debugging the code for the STRINGRA I would be very thankful to you for this :)

asked 23 Aug '17, 04:00

sagar2009kumsr's gravatar image

1★sagar2009kumsr
234
accept rate: 0%


// We can use the set in this question instead of vector // because the element must be distinct

In the sequence, repetitions are allowed.

Your code prints wrong output for this case-

Input
1
4 8
0 1
0 2
0 4
1 2
1 4
2 3
2 4
3 4
Your Output
1 2 1 3
Correct Output
1 2 2 3

In your output, you have '1' instead of '2'. But then, there must be an edge from 1 to 3 as you can add '1' at end of {1} to get {1,1}, a sub-sequence which ends at index 2 (0-based indexing). But There is no such edge, it means that sequence of {arr[0],arr[2]} has already occured before. Meaning element at index 2 is same as element at index 1.

link

answered 23 Aug '17, 13:24

vijju123's gravatar image

5★vijju123 ♦♦
15.5k12066
accept rate: 18%

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:

×193
×11

question asked: 23 Aug '17, 04:00

question was seen: 144 times

last updated: 23 Aug '17, 13:24