Unofficial Editorials January Cook Off

your solution fails too @vijju123 :smiley:

1 Like

Lmao yeah XD. If anything, my solutions always find something in the cook off :3 . The most hilarious was, when my brute force got accepted in p3 XD (I think @kingofnumber was the setter of that one)

Its not hard to miss :confused: Invitation for January Cook Off, 2018 - general - CodeChef Discuss

Invitation threads, by default, are feedback threads as well. :slight_smile:

more than 75% solutions of SURVIVIE would have failed if only the corner cases were designed properly.

Yup, I did expected a corner case somewhere on lines of not buying on sunday giving -1. But I think those cases also have N<K or some other condition which made them weaker- and hence lack of an individual case with this feature alone.

BTW, do discuss that in feedback thread, the setter will value your insight surely.

Didn’t get that.

1 Like

It fails on the corner case of “9 8 10” where it should print -1. Lucky that cases were weak :stuck_out_tongue:

@vivek_1998299 could you explain that in a bit simpler way …for noobs like me .

Ohk so lets say that elements from 1 to i-1 and its opposite side n-i+1 to N are arranged in an order .So lets say N=6 ,i=2 so we consider that a[1]<a[2] and a[5]>a[6] and lets say that we know the minimum swaps required to do this arrangement ,then we can calculate it for i=3.

So dp[i][2] indicates the minimum number of swaps required to make array great for indices 1 to i and its opposite side ,dp[i][0] denotes minimum value if i and N-i+1 indices are not swapped ,similarly dp[i][1] denotes minimum value if i and N-i+1 are swapped.

So i want to calculate dp[3][0] ,i can use dp[2][0],dp[2][1] as since i know that now values upto 2 are arranged ,i just have to check for 1 pair of element(3,4).Now i need to check if i can use dp[2][0],so just see if a[2]>a[3] and a[4]>a[5],if it is then i can use dp[2][0],similaarly do for dp[2][1](however swap a[2],a[5] and then check)

Similarly we calculate dp[3][1] but now we swap a[3],a[4] and then check the same things,(we do 1+min(…) as this swap contributes thaat 1)

1 Like

I had been busy the whole day, so i didn’t even solve the third problem, let alone writing editorial.

About official editorial, i don’t know.

Including you @vijju123 :stuck_out_tongue:

You just made 1718 people feel like genius with that xD

2 Likes

Yeah i was wondering how could so many people solve so fast

1 Like

Nice one :smiley: @abdullah768

Ohh Sorry, I meant official editorial.

“After first three digits, only the pattern “2486” repeats till end of the number”.

This is not true. It can also be all 0, e. g. 2, 3, 5, 0, 0, 0 …

I have already mentioned it

See edge case mentione above :slight_smile:

We will soon provide the official editorial. So sorry for the delays :frowning:

1 Like

For 18 out of 90 valid d_0, d_1 combinations d_4=0. That’s 20%. You call it “edge case”? :slight_smile: