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

×

codeforces educational round question doubt

this is the question and here is my solution http://codeforces.com/contest/620/submission/15504012 after coreecting the solution i got this http://ideone.com/RIqSws but it is showing it wrong . help me to find out the reason

asked 23 Jan '16, 01:59

rahulsup's gravatar image

1★rahulsup
251212
accept rate: 0%


@rahulsup, you just need to make sure that your first partition starts from 1 on the left side and final partition ends with n on the right side. -1 exist only when there are no duplicate elements in the array. Otherwise just find the partitions by greedy method and apply the conditions mentioned before.

Here is my Accepted Solution for the same.

link

answered 23 Jan '16, 02:22

likecs's gravatar image

6★likecs
3.7k2380
accept rate: 9%

If you feel your question is answered, upvote it and mark it as answered. For any other queries, you can ask in the comments section.

(23 Jan '16, 02:24) likecs6★

@likecs thanks a lot. can you tell me what is my mistake which i should correct.

(23 Jan '16, 17:50) rahulsup1★
1

Your code is similar to mine. Just add one more line regarding the 2nd condition that whenever you are having a valid solution, the last partition's second element should be n. (see my code for details)

(23 Jan '16, 20:12) likecs6★

Can anyone tell, why my code is giving a wrong answer for test case 13 for the CODEFORCES problem-> SEREJA AND BRACKETS

http://codeforces.com/contest/380/problem/C

Here is my code::: http://ideone.com/ZHQ3LW

(SORRY I DONT HAVE ENOUGH KARMAS TO POST MY OWN QUESTION... SO POSTING IT HERE LOL :-) )

link

answered 14 Jun '17, 21:52

harshitsaini's gravatar image

2★harshitsaini
92
accept rate: 0%

edited 14 Jun '17, 21:53

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:

×682
×368
×278

question asked: 23 Jan '16, 01:59

question was seen: 2,000 times

last updated: 17 Oct '17, 14:20