prnv10's blog

By prnv10, history, 10 months ago, In English

We invite you to participate in CodeChef’s Starters 215 aka Shaastra Programming Contest conducted by Shaastra IIT Madras and sponsored by Arcesium, this Wednesday, 3rd December, rated for 6 stars (i.e. for users with rating < 2500).

Time: 8:00 PM — 10:00 PM IST

Joining us on the problem setting panel are:

Register here and also please fill out this form to be eligible for the offline finals where prizes worth 200K INR await!

Written editorials will be available for all on discuss.codechef.com. Pro users can find the editorials directly on the problem pages after the contest. The video editorials of the problems will be available only to Pro users.

Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here. Hope to see you participating.

Good Luck!

  • Vote: I like it
  • +39
  • Vote: I do not like it

»
10 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by prnv10 (previous revision, new revision, compare).

»
10 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Contest starts in 30 minutes.

»
10 months ago, hide # |
 
Vote: I like it +20 Vote: I do not like it

Very beautiful leaderboard of div2 div3 div4

»
10 months ago, hide # |
← Rev. 4  
Vote: I like it +4 Vote: I do not like it

Nice problems , I solved this Intersecting Intervals in a tedious way. :) should have spent more time to think of easier implementation.
I thought this as a harder version of standard maximal subarray sum + point updates.

I tried to maintain all these parameters and merged them correctly in segment tree, and it worked.

struct Info {

    ll Atot  = -inf; // sum of A within the node
    ll Btot  = -inf; // sum of B
    ll ans   = -inf; // answer for the node.

    ll Apmax = -inf; // A array max prefix sum
    ll Asmax = -inf; // A array max suffix sum
    ll Bpmax = -inf; // B array max prefix sum
    ll Bsmax = -inf; // B array max suffix sum

    ll ansAR = -inf; // answer, such that A subarray touch Right end
    ll ansAL = -inf; // answer, such that A subarray touch Left end
    ll ansBR = -inf; // answer, such that B subarray touch Right end
    ll ansBL = -inf; // answer, such that B subarray touch Left end

    ll ansALBL = -inf; // answer such that A array touch Left, B touches Left
    ll ansALBR = -inf; // answer such that A array touch Left, B touches Right
    ll ansARBL = -inf; // answer such that A array touch Right, B touches Left
    ll ansARBR = -inf; // answer such that A array touch Right, B touches Right

    ll Asubmax = -inf; // maximal subarray sum of A array
    ll Bsubmax = -inf; // maximal subarray sum of B array
};
Merge function

Code Submission It passed in 0.5 sec :) Time complexity. (50*NlogN)