### ajs97's blog

By ajs97, history, 5 years ago, Techkriti 2017 and samsung research India brings forward International Online Programing Contest (IOPC) with a chance to grab your pile from INR 1,20,000. This is a rated contest of 3 hrs and will start at 15:00 IST on the 21st of April,2017. There is a little under 12 hours left till the contest starts.
The contest is hosted on codechef.

Contest page : https://www.codechef.com/IOPC2017.

Note that the contest is an individual rated contest on Codechef.

The problem setters are utkarshl, kaushal02 and dwivedi with triveni and Dopahkiin as testers.

The prize distribution is as follows:
1.The international first,second and third get 20%,17% and 13% of total money respectively.
2.The 4th and 5th positions (international) get 10% & 8% respectively. positions 6-10 get 1.6% each.
3.The first, second and third in India get 10,8 and 6 percentage of total
4. In case if someone is eligible for more than 1 prize, he gets the larger one only.

Hoping for a huge response from everyone. May the Force be with you! iopc, Comments (14)
 » Auto comment: topic has been updated by ajs97 (previous revision, new revision, compare).
 » We have not received the prize money from IOPC 2015.
 » The codechef contest drop down list says Techkranti — IOPC 2017. xD
 » 5 years ago, # | ← Rev. 2 →   Where does this fail for this problem ? I just simulated everything using segment tree.
•  » » segment tree is not required.Its just basic recursion. Its a variant of standard version of Josephus problem. Codell compute(ll n,ll k,ll orig,ll sign){ if(n==1) return 1; if(sign==1){ ll val=compute(n-1,k+orig,orig,0); val-=1; if(val==0) k--; else k+=val; k%=n; k+=n; k%=n; val=k; //cout<>t; while(t--){ ll n,k; ll sign=0; cin>>n>>k; if(k>0){ sign=1; } if(k<0){ k*=-1; sign=0; } cout<
•  » » get_ac function takes int k, while it overflows in main — various similar mistakes like this. I just simulated everything using BIT and it worked fine.
•  » » » Nothing would overflow. i have #define int long long in the code.
 » How to solve Christmas Time?
•  » » 5 years ago, # ^ | ← Rev. 3 →   Read up on [Partition Function](https://en.wikipedia.org/wiki/Partition_(number_theory)#/Generating_function). You can calculate P(n) in O(sqrtN) using generalized pentagonal numbers. Then query for N, M reduces to range product of P(i), for i over the range [M, M+N-1] which you can do in O(1). Overall time complexity is O(NsqrtN + Q).
•  » » Let A(n) be the number of ways to distribute n sweets . Then A(n) = A(n - 1) + A(n - 2) - A(n - 5) - A(n - 7).... i.e where X(i) is the ith pentagonal number. Rest is just building prefix product of this array.
•  » » 5 years ago, # ^ | ← Rev. 2 →   My solution with space complexity passed in Java. Was this expected or the time limit was bit too relaxed for Java?
 » Can someone please explain the approach for https://www.codechef.com/problems/IOPC17G/
•  » » 5 years ago, # ^ | ← Rev. 4 →   See this code — https://www.codechef.com/viewsolution/13376017 If the intervals intersect, it is the right end point of the interval that ends first. Else, let [a,b] be the first interval and [l,r] the second with b (a-1)/x=(a-1)/x, so there is no need to check x'. So from a given x we need to check only next smaller number x' such that b/x' or r/x' is different. This is a major optimization since there are only O(sqrt(r)) different r/x. So, from a given x next x' = max(r/(r/x+1),b/(b/x+1)). Complexity = O(sqrt(r)) for a test case.
•  » » » Thanks.