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

×

a good set solve ?

okay, so I used two way to do this problem, first is using a custom fibonacci where instead of f(a) = f( a - 1 ) + f( a -2 ), I turned it into f(a) = f(a - 1 ) + f( a - 2 ) + 1, this should make sure that it meets the requirements, and it did, albeit only for the first subtask, next I used a method that will definitely meet the requirement, by having the output like this, e.g input 1, outputs 1 input 2, outputs 1 11 input 3, outputs 1 11 111 input 4, outputs 1 11 111 1111 if the outputs are like this, there should be no way that the output don't meet the requirements, and yet I got WA for both subtask...weird anyways, here is my submission

asked 13 Jun, 16:26

flaze07's gravatar image

2★flaze07
1536
accept rate: 21%

Please use the problem code in the title of the question while asking a question. For example, one possible title could be: "Help in solving the problem GOODSET". Also, it's good to provide the link to the problem too. Thanks for asking the question and accepting the answer :)

(14 Jun, 19:58) admin ♦♦0★

I agree that the title is not optimal, but at least the submission was linked which shows the problem in question, so it wasn't too bad at all.

(15 Jun, 01:40) algmyr7★

yeah, I always put the problem link when I ask this kind of question

(15 Jun, 07:45) flaze072★

You missed the constraint that all elements should be in the range 1 to 500.

link

answered 13 Jun, 19:13

algmyr's gravatar image

7★algmyr
1.2k13
accept rate: 37%

welp, guess I need to pay more attention to constraint huh

(13 Jun, 21:17) flaze072★

Fibonacci grows very quickly, you probably want something that doesn't grow exponentially fast. This would be a problem even if the problem statement didn't state that numbers should be between 1 and 500 as the 100 Fibonacci number is $354224848179261915075$ and doesn't even fit inside of a ulong.

A small hint:

View Content
link

answered 13 Jun, 19:37

gorre_morre's gravatar image

7★gorre_morre
934210
accept rate: 42%

gotcha, then all I need is to start it off with 10, or any number that is bigger than one edit : nvm, it is not that I can just start with numbers of any kind

(13 Jun, 21:18) flaze072★

The important thing is to not start with small numbers.

(13 Jun, 21:22) gorre_morre7★

There is a more beautiful way to do it than that. One hint: parity

(14 Jun, 02:27) algmyr7★

ok, nevermind, I decided to just output 400 until 500 and it works, yeah I guess I know why, because 400 + 401 is already 801

(14 Jun, 08:16) flaze072★

Great! Btw about Algmyr's hint, you could just have used odd numbers =p

(14 Jun, 19:31) gorre_morre7★

well...didn't think of that

(15 Jun, 07:44) flaze072★
showing 5 of 6 show all
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:

×133
×8

question asked: 13 Jun, 16:26

question was seen: 223 times

last updated: 15 Jun, 07:45