Invitation to CodeChef May Long Challenge 2018!

i checked you recent submission, these lines are still incorrect.

ll x = (b[i] - b[1]) % MOD ; this can go negative so re write it as ll x = (b[i] - b[1] + MOD) % MOD ; and same for the next line.

sum = (1LL * pre_fib[n - 1] % MOD * x * m) % MOD; This can cause integer overflow because you are multiplying 3 integers of magnitude 10^9 so re write it as, sum = (pre_fib[n - 1] * 1LL * x % MOD) * m % MOD;

Check for above two mistakes in full code, hope this helps.

welcome :slight_smile:

I don’t know python much but ur algo seems correct…

There were lots of conditions involved in that question. But even on missing some, at least some cases passed. Dont know python, but I advise checking up others solution for reference.

I will confirm this with @admin and get back to you. :slight_smile:

Never mind. I forgot to loop over the test cases. :))

Same Error
https://www.codechef.com/viewsolution/18579584

Any updates @admin @vijju123 ?

@rj25 unfortunately, it doesn’t work that way, If you hover over the rank after filtering, it shows you the rank according to filter.

The Indian rank of first person at 107 is 35.

1 Like

It’s a Dynamic Programming problem but you won’t directly reach DP. Realise that two adjacent elements can never be negative. Further an element a[i] can be negative only if a[i-1] > a[i] < a[i+1]. Next if you do above you will get an alternating sequence a[i], a[i+2], a[i+4], … a[i + 2*k] where you have to set some of them to negative such that negative sum is maximized but you can not select two adjacent elements. This is where DP comes into the picture. This another version of the classic DP problem “Maximise the sum of array such that no two elements are adjacent.”.

2 Likes

SPOJ.com - Problem FARIDA Try this DP problem first. It has the same concept.

I am in talks with them. I will update on the issue as and when possible

Here are editorials for April Lunctime. @mgch, commented here

April LTIME Editorial

1 Like

Thanks @sorb1997 for helping out!

Thanks @vivek_shah98!

@vijju123 Any updates? What exactly is causing the delay?

For April lunchtime? I dont think I have permission to give it out publicly. You can PM/mail if you’re very curious.

Here is my solution: My Solution to S-T Mincut from May18 - editorial - CodeChef Discuss

Here is my solution: My Solution to S-T Mincut from May18 - editorial - CodeChef Discuss

I meant any updates about May Long Editorials. I saw that only DBFB is out and I read somewhere that the editorialist needs time but that was 2 days ago I think.
I know many people have posted their solutions for some problems but not SERSUM, which is the main reason I’m asking for editorials. I’ll open up a new question if the editorials take too long but it’s better to keep all the discussion about the problem on the editorial page itself.
@vijju123

@psaini72 - That DFDB editorial is unofficial one. Because the editorialist for this contest is @triveni (also, the editorialist doesnt mention setter’s solution, name of tester etc.).

Yes, I agree it feels frustrating to you. The same case is with April Lunchtime as well. The editorialist needs more time/is stuck. I am trying my best to make sure something is done about them, and that they arent forgotten.

No use opening a new question tbh. @admin sees it here. I mean, if a I am already working on it, what more can a question do? :frowning:

I am trying my best for a speedy solution, I assure that