GreenGrape's blog

By GreenGrape, 5 months ago, translation, In English,

Hey, Codeforces!

Hope that the last few days were quite productive for all of you in terms of rest and pleasure. Time to forget about messing with handle colors and get back to coding!

I'm proud to usher the first contest of the year — Codeforces Round #456, which is going to be held on Friday, 17:35 MSK. The round will be rated for all division 2 participants. Anyway, we will be glad to see whoever decides to join us out-of-competition :)

The authors are — GreenGrape and rek (don't worry, it's all about New Year magic ^^). My heartfelt gratitude to Kolya (KAN) for his invaluable help in round coordination, Grisha (gritukan) and Oleg (x3n) for testing and correcting statements, Dima (cdkrot) and Gleb (glebodin) for preliminary solving, AmirReza (Arpa) for close reading and Mike (MikeMirzayanov) for awesome Codeforces and Polygon platforms.

We look forward to brightening up your cold winter evening :)

GL & HF!

UPD. There will be five problems with the following scoring:
500 — 1000 — 1750 — 2000 — 2500
As usual, it's strictly recommended to look through all problems :)

UPD. Please note that the registration was delayed for a few hours.

UPD. The contest is over.
It turned out to be a little bit more complicated than we expected. Still we hope you learned something new :)

UPD. Editorial!

UPD. Congratulations to the winners!

Div. 2:

  1. apink
  2. anger_of_singledogs
  3. markiz
  4. supy
  5. ratel

Div. 1 (unofficial):

  1. dotorya
  2. ksun48
  3. irkstepanov
  4. Benq
  5. quailty
 
 
 
 
  • Vote: I like it  
  • +499
  • Vote: I do not like it  

»
5 months ago, # |
Rev. 2   Vote: I like it +29 Vote: I do not like it

The announcement is made early for once :)

»
5 months ago, # |
  Vote: I like it +136 Vote: I do not like it

For some of us it might be morning

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +82 Vote: I do not like it

    Where are the other Grapes?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    Hopefully it doesn't impact the registration statistacks

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it +3 Vote: I do not like it

      I always check statistacks at right time

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +24 Vote: I do not like it

    For some of us it's summer (yay, southern hemisphere). I'm guessing some peole even have it as summer AND morning!

»
5 months ago, # |
  Vote: I like it +22 Vote: I do not like it

"Time to forget about messing with handle colors and get back to coding!"

If the registeration was by color ... there would be no div.2 participants, the whole scoreboard will be painted in red :D

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +9 Vote: I do not like it

    Meanwhile the contest-setter himself also messing with handle colors

»
5 months ago, # |
  Vote: I like it +173 Vote: I do not like it

Don't skip the opportunity to hack legendary grandmasters

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +7 Vote: I do not like it

    Thank you for remaining this moment)

  • »
    »
    5 months ago, # ^ |
      Vote: I like it -36 Vote: I do not like it

    you even might be able to hack some tourists if you know what i mean ;)

»
5 months ago, # |
  Vote: I like it +22 Vote: I do not like it

Thank you GreenGrape for one more contest, also I'm really thankful to MikeMirzayanov for giving us chance to have fun.Good Luck and Have Fun)

»
5 months ago, # |
  Vote: I like it +63 Vote: I do not like it

At first, I freaked out seeing the authors' handle colors...then I looked at my handle color xD

»
5 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Wew!@ Time to do what I once didnt/couldn't:)

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

Welcome to the first contest in 2018. Sure fun for us.

»
5 months ago, # |
Rev. 3   Vote: I like it +5 Vote: I do not like it

First one in 2018 ;)
IsIt0.5Rated?

»
5 months ago, # |
  Vote: I like it +5 Vote: I do not like it

a lot of Legendary grandmaster will participait in this contest sounds like very intresting :)

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

New Year magic workouts! Makes LegendaryGrandmasters to Brain storm for score in Div.2.

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

hacking might get confusing!

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +16 Vote: I do not like it

    don't worry, now colors are deceptive, but during the contest they will be returned to the real state if I'm not mistaken.

»
5 months ago, # |
  Vote: I like it +7 Vote: I do not like it

Wishing everyone high ratings and lots of green AC this year

»
5 months ago, # |
Rev. 2   Vote: I like it -44 Vote: I do not like it

LOL

»
5 months ago, # |
  Vote: I like it -17 Vote: I do not like it

rated hahahaha

»
5 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

My solution was caught in plagiarism with another of my own solution in the last educational codeforces round. The problem has not been rectified yet. Can somebody help ????

Upd: The solutions have been accepted but the rating change has not been reflected. P.S I am a div2 contestant . Don't look at my color.

Upd2: I saw mike's blog post . The issue has been resolved. Thanks

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

Time for changing color ;p

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

A contest where newbies and pupils will hack grandmasters codes. :P

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

Old handles are appearing in the contest registrants page instead of new ones, is it a bug? Or its meant to be ???

»
5 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Fastest score distribution ...!!! :)

»
5 months ago, # |
  Vote: I like it -32 Vote: I do not like it

this contest will be pretty confusing to these people who depend on color to hack

»
5 months ago, # |
  Vote: I like it +7 Vote: I do not like it

My new year's resolution : "Become a candidate master". Wishing for ratings, not colour. :)

»
5 months ago, # |
  Vote: I like it -6 Vote: I do not like it

RUSH B!!!!!!!!!!!!!!!!!

»
5 months ago, # |
  Vote: I like it -26 Vote: I do not like it

I hope D and E will be very difficult so nobody can solve them

»
5 months ago, # |
  Vote: I like it +5 Vote: I do not like it

There are so many Red Coders participating this time!! :P

»
5 months ago, # |
  Vote: I like it +3 Vote: I do not like it

I have a bad feeling, looking at the long queue 3 minutes before the contest...

»
5 months ago, # |
  Vote: I like it -9 Vote: I do not like it

I hope D and E will be very difficult so nobody can solve them

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +18 Vote: I do not like it

    Should've hoped for a Million dollar.

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it -11 Vote: I do not like it

      HAHA Looks like problems D and E are very difficult.

      • »
        »
        »
        »
        5 months ago, # ^ |
          Vote: I like it +9 Vote: I do not like it

        Easier than C

        • »
          »
          »
          »
          »
          5 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Would not be surprised if more people solved both D and E than C

          • »
            »
            »
            »
            »
            »
            5 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Hey, you were right.

            Seems like people of codeforces do not like reading essays.

»
5 months ago, # |
Rev. 2   Vote: I like it +18 Vote: I do not like it

I believe the problem setter has set the questions seeing the color of participants and not ratings. :(

Now I realize, how tough it is to be a LGM.

»
5 months ago, # |
  Vote: I like it +13 Vote: I do not like it

does Problem C refers to Dota2? Lol

»
5 months ago, # |
  Vote: I like it +9 Vote: I do not like it

I don't even understand C

»
5 months ago, # |
  Vote: I like it +71 Vote: I do not like it

Balancing the difficulty of problemset is the ground rule for preparing of contest.

»
5 months ago, # |
  Vote: I like it +3 Vote: I do not like it

How to solve E?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    Meet in the middle and binary search

    • »
      »
      »
      5 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Can you explain your approach. I just hoped that bitmask will suffice.

      Okay, understood. I actually thought about MIM but didn't think bitmask would be tle.

      • »
        »
        »
        »
        5 months ago, # ^ |
          Vote: I like it +5 Vote: I do not like it

        Divide array two parts and calculate answers for them as you do in MITM. Then binary search answer with counting numbers which satisfies condition. Be careful with overflow, it cost me 3 WA and a lot of time

»
5 months ago, # |
  Vote: I like it +13 Vote: I do not like it

Is intended solution for E is binary search + meet in the middle?

»
5 months ago, # |
  Vote: I like it +7 Vote: I do not like it

Can anyone help me with D? :(

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +6 Vote: I do not like it

    Linearity of expectation

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Can you please elaborate

      • »
        »
        »
        »
        5 months ago, # ^ |
          Vote: I like it +2 Vote: I do not like it

        Expected number of fishes caught = Σ P(catching fish at (xi,yi))

        Now, select k distinct (xi, yi) such that sum is maximised.

        P(catching fish at (xi,yi)) = (#Net positions covering (xi,yi))/(#All Net positions)

        We can start by selecting middle element, and adding neighbors in the order of decreasing probability (using priority queue)

        • »
          »
          »
          »
          »
          5 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          How do you compute the probability for each of the individual cells of the matrix?

»
5 months ago, # |
  Vote: I like it +9 Vote: I do not like it

That moment when all you do in life is play DotA 2 and you can't even solve problem C which discusses the Hero Zeus' ulti.

»
5 months ago, # |
  Vote: I like it +28 Vote: I do not like it

My thought process while trying (and failing) to solve C:

At first I was overwhelmed by all the information, but then I realized I can probably store times where regen graphs cross the damage threshold in a treeset and process them before/after each query as needed, and simply ignore everything with maxhealth <= damage, as they will always be killable, so as a result if everyone's max health is less than damage you can kill them anytime (infinite bounty).

An hour of spaghetti later, I submit and get WA

"Oh, obviously! I forgot the case if regen of an enemy is equal to zero!"

WA again same test case

"Oh, of course! I forgot the case if increase = 0, then bounty can never be infinity"

WA again same test case

"Oh, right. He can only do integer values, so if it's not evenly divisible I have to consider integer value right before crossing the threshold and right after..."

WA again same test case

There are too many special cases and other things to consider in this problem in my opinion. Maybe Dota2 players who code are super familiar with the algorithm because they do it in their head every time they play, but for the rest of Div2 Codeforces it is not quite as easy. That's the only way I can think of this problem being selected as a C problem.

Anyway reply with elegant approaches/solutions if you'd like, they will be much appreciated.

  • »
    »
    5 months ago, # ^ |
    Rev. 3   Vote: I like it 0 Vote: I do not like it

    Important realisations: 1) If bounty increase is >1 and the max_health of any enemy is <= damage, the answer is -1 2) If bounty increase is >1 and health increase of any enemy is 0 and the last updated health of an enemy is <= damage, the answer -1

    After taking care of those special cases it is just easy time_line problem where you mark all the +1/-1 points (new enemy I can kill/since this point I can not kill some enemy).

    I used multiset at first, map later ended up with sorting a vector of time-line points, however always got TLE on the 8th test-case.

    Overall nice problems, but really pissed by the distribution of correct solutions of the tasks (compare C to D or B).

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    C is annoying to code even if the solution seems elegant while thinking. Maintain 2 sets (RIP and non-RIP, RIP for heroes whose current health <= damage). Maintain an event priority queue. There are three kind of events: -1 (compute bounty), 0 (transfer a given hero from RIP to non-RIP set, to account for regen), 1 (Set current health of a given hero). Process the events in priority (-time, type). There are still annoying edge cases to handle (For example, future events of type 0 can be invalidated by events of type 1).

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Wait for the authors' solutions, they are much more elegant :)

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +5 Vote: I do not like it

    missed the case when increase = 0 but still passed pretests :/

  • »
    »
    5 months ago, # ^ |
    Rev. 2   Vote: I like it +8 Vote: I do not like it

    I'm sorry to break it to you. But this is nothing like Dota2. The mechanism are totally different. The idea is only about Dota 2 nothing more. Examples:

    1) No hero has 0 regeneration

    2) Bounty is not this way

    3) You don't care how much gold you get and the bonus will never become infinity So, knowing Dota2 will completely change nothing.

    • »
      »
      »
      5 months ago, # ^ |
      Rev. 2   Vote: I like it +8 Vote: I do not like it

      1) Ancient Apparation's ult or Spirit Vessel effect
      2) That's true, I must admit :)
      3) You actually do care about the amount of gold you get when you play Dota 2

      Though you are right that Dota 2 experience would not really help with solving this problem :)

      • »
        »
        »
        »
        5 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Well, what's important is general agreement.

        The statement implies that there can be a hero with 0 regeneration throughout the whole match, and that's impossible.

        You can't deny the fact that when you can kill, you'll kill. It doesn't matter how many you kill (AND YOU DON'T WAIT TO +INF TO USE YOUR ULTI)

        What's important is playing Dota 2 won't help you solve the problem, practicing will!

»
5 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
If (k == 1) {
  cout << n;
  return 0;
}
»
5 months ago, # |
  Vote: I like it +5 Vote: I do not like it

B is a b!*ch -_-

»
5 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Didn't even read C

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

Any idea what TC4 is in C?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    increase = 0

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Oh right, answer will never be -1 in this case.
      Thanks

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

Idea for E?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +26 Vote: I do not like it

    split array into two parts (I had 6 and 10)
    calculate all possible numbers for every part with dfs in two arrays L and R
    then do binary search for answer and you must for mid calculate how many are there i and j that L[iR[j] ≤ mid
    that can be done with two pointers
    works 1.5 sec

»
5 months ago, # |
  Vote: I like it +8 Vote: I do not like it

In div2.B I didn't read "no more than k", I thought I had to choose strictly k. :c RIP rating.

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    in B i thought it was saying about exactly k element need to take.

    but after 1 hour i saw that not more than K.

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I thought it was exactly k too, but I don't think it matters for me because I couldn't solve it anyway

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Just set all the bits.

      • »
        »
        »
        »
        5 months ago, # ^ |
        Rev. 4   Vote: I like it 0 Vote: I do not like it

        Oh yeah, I think "at most k" is easier, because it is guaranteed to find two numbers in range 1..n who are 1's complements of each other ..

        is the answer 2^( ceil(lg(n)) )-1 ?

        • »
          »
          »
          »
          »
          5 months ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          find the right most set bit of n and set all the lower bits. If x is rightmost set bit then ans is = 2^x +2^(x-1)+...+2^0

          Base case if K=1 then ans is n

          • »
            »
            »
            »
            »
            »
            5 months ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            Yeah, and 2^x +2^(x-1)+...+2^0 = 2^(x+1)-1

            Can't believe it was so simple >_>

»
5 months ago, # |
  Vote: I like it +15 Vote: I do not like it

Is D just hard work with cases and formulas or there's some elegant solution?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +43 Vote: I do not like it

    Maybe mine
    I had Dejkstra algorithm. Just start from (n + 1) / 2, (m + 1) / 2
    take each time point with largest cost
    cost can be calculated like this

    code
»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone tell me what's wrong with this hack?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    The fact, that only you can see it =)

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Oops, sorry. It will probably be available after systests.

      It's a hack for problem C:

      3 1
      1 0 100
      10 10 0
      10 10 0
      10 10 0
      1 1 10
      
»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

It seems me, that Python and accuracy are incompatible http://codeforces.com/contest/912/submission/33928268

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Not just python, I've seen some C++ solutions using log2() failing on the same test.

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Devil made this test by himself)

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      a similar thing happened to me... still scratching my head where i went wrong

      code

      • »
        »
        »
        »
        5 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        log2() and pow() work with doubles, not ints, so there will alway be some inaccuracy.

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I also failed it the same way, with cpp.

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    will math.ceil work?

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

Problem A: very funny...

»
5 months ago, # |
Rev. 3   Vote: I like it +64 Vote: I do not like it

After reading Problem C

  • »
    »
    5 months ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it

    I read it twice and gave up and started to be dubious about my English reading ability...

»
5 months ago, # |
Rev. 4   Vote: I like it +2 Vote: I do not like it

Problem D: Use linearity of expectation.

For a cell (i, j), number of squares can be calculated like this: https://ideone.com/KbWoW7 (For upper left corner You find a valid range for lines, a valid range of columns and then you multiply the ranges lengths)

Now we have 2 vectors L(i) = the length of range for line i, C(j) = the length of range for column j. So number of squares that contain cell (i, j) = L(i) * C(j);

Sort vectors L and C in descending order. So L(0) >= L(1) >= ... >= L(num_of_lines) , C(0) >= C(1) >= .... >= C(num_of_columns)

Now at each step we need to choose a line i and a column j which gives the best L(i) * C(j).

Mantain a vector Last(i) = For the line i, what is the best column avaible? At the beginning Last(i) = 0;

We'll keep a multiset where we insert all lines, and we will keep the multiset sorted by L(i) * C(Last(i)) descending order.

Now, we do this k times: Extract beginning of set = A line i, add that L(i) * C(Last(i)) Value. Update Last(i) = Last(i) + 1 Add i to multiset again.

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Can you please explain the thought process behind the formula to calculate the number of squares for a cell.

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

If you solve E with only bitmask (and reverse sorting the given list of primes), what's the complexity?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    Still won't pass. I did my best putting in tons of heuristics ( that I even used to accept similar problems before), and always got TLE on pretest 5/6. Test cases are strong, good job to the testers/authors.

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Interesting. I thought as the masks grow, the number of values we need to try decrease significantly. Probably some randomization will be needed. What's the complexity anyway

»
5 months ago, # |
  Vote: I like it +21 Vote: I do not like it

E passed, time to back Div.1! :-)

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

I used tenary search for problem C, i still dont know where im wrong Here my code : https://ideone.com/grWZlx

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    The function must be convex or concave for ternary search, this isn't.

»
5 months ago, # |
Rev. 2   Vote: I like it +8 Vote: I do not like it

Today I realized,

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

Problem C. Test case 4 is wrong 2 0 1 0 1 10 1 1 2 1 0

The second enemy has start health = 1, regen = 0. So I can wait forever to kill him (I have damage = 1), so I can have infinitely gold. The answer is -1. But Jury's answer is 2.

My submission. 33945948,

»
5 months ago, # |
Rev. 3   Vote: I like it +5 Vote: I do not like it

Shouldn't they be disqualified because of cheating?

http://codeforces.com/submissions/Combi/contest/912
http://codeforces.com/submissions/Cinzaderius/contest/912
Upd: Only 1 submission was skipped, really?

  • »
    »
    5 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it
  • »
    »
    5 months ago, # ^ |
    Rev. 2   Vote: I like it +5 Vote: I do not like it

    Wait Wait! there's no cheating there, they have a huge difference in problem B, one declared int and the other declared long ;o ._. haha. now on a more serious note :/ come on guys this is to improve over time not just for the ratings.

    • »
      »
      »
      5 months ago, # ^ |
      Rev. 2   Vote: I like it -7 Vote: I do not like it

      I'm send my apology to everybody scerely because of that cheating.I won't send my code to him anytime in the future.Please excuse me!

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    They are friends, I'm sure that the next time, they will continue cheating by changing template, such as #define int long long — #define long long long, etc... to avoid being skipped

»
5 months ago, # |
  Vote: I like it +2 Vote: I do not like it

Why this formula (pow(2,floor(log2(n))+1)-1) failed for #test 48 (n=288230376151711743, k=2) in problem B

  • »
    »
    5 months ago, # ^ |
    Rev. 2   Vote: I like it +4 Vote: I do not like it

    There are issues with built in logarithmic functions. For example, in python, the log of that number is 58.0000001 while the actual log is 57.9999...

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I used builtin log function even after being aware of this issue and having evaded this problem many times in the past. -_-

    • »
      »
      »
      5 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      But same code got accepted when I changed long long to long double for n and k. Why is this so?

      • »
        »
        »
        »
        5 months ago, # ^ |
        Rev. 4   Vote: I like it +14 Vote: I do not like it

        log2 and friends (log2f and log2l), as in the C standard library, accept only double, float and long double parameters. So what happens when you pass a long long to it? C++11 (and future versions) explicitly say integral types get converted to double (not long double!) before calling functions from <cmath>. Since the values in this testcase are not representable as a double, you get precision issues.

        Below's what the standard says in §29.9.1. Rule 2 applies in your case.

        "For each set of overloaded functions within <cmath>, with the exception of abs, there shall be additional overloads sufficient to ensure:

        1. If any argument of arithmetic type corresponding to a double parameter has type long double, then all arguments of arithmetic type (6.9.1) corresponding to double parameters are effectively cast to long double.

        2. Otherwise, if any argument of arithmetic type corresponding to a double parameter has type double or an integer type, then all arguments of arithmetic type corresponding to double parameters are effectively cast to double.

        3. Otherwise, all arguments of arithmetic type corresponding to double parameters have type float."

        • »
          »
          »
          »
          »
          5 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I use type conversion. Even after it will not work.

          a = ((double)log2(n))

          • »
            »
            »
            »
            »
            »
            5 months ago, # ^ |
            Rev. 2   Vote: I like it +29 Vote: I do not like it

            Casting the return value cannot provide you with more precision (since the value is already calculated). That would be CSI-level enhancing :)

            We want to ask the function to calculate using type long double. There are two ways to do that: log2l(n) or log2((long double)n).

            • »
              »
              »
              »
              »
              »
              »
              5 months ago, # ^ |
                Vote: I like it +15 Vote: I do not like it

              Thanks for the reply. Now it is working. Thank you again.

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The same condition happens to me and this is the very worst thing. Else we also get contest rating as well. 48.....

  • »
    »
    5 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    I also faced the same problem and got wa only for this issue. i tried to get log2 by doing log10(n)/log10(2) but got wa.. while debugging the only thing i got was a precision related issue which i'm experiencing for first time in a built in function.. calling log functions with an extra 'l' at last(taking long double as arg) worked fine..

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

Please note that this announcement is not (yet) attached to the contest.

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

why is rank of some users different from what their rating indicates? this probably happened during Goodbye 2017 coontest.

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

prob b http://codeforces.com/contest/912/submission/33945293 test 5 works on the csacademy compiler, but its not the correct answer here?

  • »
    »
    5 months ago, # ^ |
    Rev. 3   Vote: I like it +9 Vote: I do not like it

    1UL has type unsigned long. (unsigned) long on 64-bit architectures is a 32-bit type on the Windows ABI and a 64-bit type on Linux (LP64 ABI). Codeforces runs on Windows. You wanted 1ULL :(

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

Where did the editorial go?

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

My solution for A works more than 1 sec. On this test 10^9 10^9 0 10^9 0 Weak tests...

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

Please help me out with Problem B Link to code- http://codeforces.com/contest/912/submission/33950052 I first convert number n to binary, then traverse the binary string checking if '0' is there -> convert it to '1' and decrement k. Getting WA from test case 9.

»
4 months ago, # |
  Vote: I like it -14 Vote: I do not like it

the round was trash never problemset again

  • »
    »
    4 months ago, # ^ |
      Vote: I like it +4 Vote: I do not like it

    How can you be sure if you didn’t even solve B?

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it -8 Vote: I do not like it

      i didnt even read the problem B mommy came in room and told me we had to go doktor and i had to leave but shit contest nonetheless becauyse i coldnt fully participate and me rating droped to shit.

    • »
      »
      »
      4 months ago, # ^ |
        Vote: I like it -8 Vote: I do not like it

      plus ur a pupil so you shouldnt set problems at your level

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

Hi, Could anyone tell me why Jury's answer for case 11 of Problem C is 1 ? Since I see there is a horizontal line (value = 1), my answer is -1. [input] 1 0 1 0 1 1 1 1