[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Is codechef a fucking retard? Or am I? I have this problem

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 11
Thread images: 3

File: orami.png (252KB, 3888x3236px) Image search: [Google]
orami.png
252KB, 3888x3236px
Is codechef a fucking retard?
Or am I?

I have this problem to solve: https://www.codechef.com/problems/SUMTRIAN

And this was my proposed solution: http://pastebin.com/TuXJ0FUw

It follows the logic of pic related.

Works fine with the test values and some of my own.

Codechef says it's a wrong answer.

Is it right or not?!
>>
File: the code.jpg (38KB, 587x795px) Image search: [Google]
the code.jpg
38KB, 587x795px
Have a more readable version of the code.
>>
How many different paths are there in a triangle with 4 rows brainlet?
>>
>>8603648
0 rows -> 0 paths
1 row -> 1 path
2 rows -> 2 paths
3 rows -> 4 paths
4 rows -> 7 paths
5 rows -> 12 paths

For 'n' rows you have 1 + a + b, a being the amount of paths for n - 1 rows and b for n - 2.

Want the general solution senpai?
>>
>>8603374
you're wrong. why don't you look at the accepted solutions and compare?
>>
>>8604472
The accepted solutions are fine and use different but equally valid methods which should lead to the same outcome mine reaches with any test case.

I need an explanation. Why am I wrong?
It doesn't look like the solution is wrong.
>>
>>8604456
Hint:At every fork, you can choose between one path or the other. You have an even amount of choices. An even amount of choices would not lead to an odd amount of paths

In fact, 7 is prime, so there's literally no way to arrive at 7 paths.
>>
>>8604478
as an ICPC world finalist, let me tell you this: the process of fixing your answer and understanding why it's wrong is very important, as much as writing it itself
>>
>>8604478
I just ran your code with their sample input and it does not match their output.
>>
>>8604487
This

Not trying to make you look like an idiot OP, just trying to make you see where you went wrong.
>>
File: orami.png (73KB, 3888x3236px) Image search: [Google]
orami.png
73KB, 3888x3236px
There was another possible path and I didn't consider it.

Thanks everyone for your help.
Thread posts: 11
Thread images: 3


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.