Hello Codeforces!

On Thursday, 20 April 2017, 13:00:00 GMT , an online mirror of the Bangladesh National High School Programming Contest (NHSPC 2017) will be held at Codeforces Gym.

The problems were prepared by :

RHaque, immuntasir, Jami_CSEDU, nafisiham, prophet_ov_darkness, raida_ash, shadowfax, tanzon0xA5 and tube_light.

This is an individual contest hosted as a preliminary selection contest for IOI participants of Bangladesh. You will have 3 hours to solve the problems. The setters have decided to rate the difficulty of the contest to be 3 stars. There's a wide variety of problems and we hope that you would enjoy the problems in general and have fun solving the contest.

Best of luck.

**Update1:**

The contest has finished. The top 5 are:

Thanks everyone. The editorial will be posted very soon.

**Update2:**

Editorial has been published.

:-)

Where is the link to the contest?

You can locate it in gym :)

What about the link of the contest? How can we join it?

Here

I have participated in junior category and stood 3rd. In the contest name in gym its written senior category. Should I join that one or another contest for juniors will be held?

You can participate in this contest.

Shall I have to register or I can directly enter at the contest time?

You don't have to register. You can directly enter the contest

How many problems are there? What's the idea behind having 3 hours instead of 5 hours like the IOI?

There are 8 problems. Actually this is the third edition of this contest. The previous two years, this contest has been arranged to motivate high schoolers for competitive programming. This year for the first time, it has been also used as a preliminary selection contest for Bangladesh IOI team. So the problems may be a bit different from IOI problems. That's why the number of problems and time length is different from IOI.

How to solve D ??? I tried so hard but could not do it ... I am feeling dumb :( Will editorials be posted ???

The editorials will be posted soon. We are working on it. :)

The answer is the number of numbers such that excluding that from nimsum will result in a number less than the main number.

i.e first calculate

nimsum. For each numbera_{i}, if (nimsumxora_{i}) <a_{i}then increase answer by 1.How did you arrive at it ???

I arrive at this during the onsite contest.

The key observation was, from a pile you can take pebbles in only one way to make a loosing state, if you take something more or less it will always lead yourself to loosing state.

And to make a loosing state for other, it will be possible only if (

nimsumxora_{i}) <a_{i}. Try to prove yourself :)Thanks :)

Auto comment: topic has been updated by tanzon0xA5 (previous revision, new revision, compare).Can I solve problem B with Binary Search on range [1..5000] ?

Also is the worst possible case 1 1 1e19 ?

I seem to be getting TLE with binary search Java

range [0...5000] in case n >= p already also, how are you checking that the current mid is >= p?

I am using BigDecimal compare which is has a O(lgn) complexity. So I compute x = (1+r%) once and then each iteration I do

x^mid where mid = lo+hi>>1; is the number of years

after that I do n*(x^mid); so as to complete the compound-interest formula.

I've the same solution, may the problem be with power function (you need to do fast exponentiation) or with using the BigDecimal, I'm not sure about the O(lgn) complexity to be honest.

Try using only doubles and unsigned long long for p, that will be sufficient

Editorial has been published.