IgorI's blog

By IgorI, history, 5 months ago, translation, In English

Hello Codeforces!

Now the winter SIS (Summer Informatics School) is taking place, and parallel A+A0 and its teachers have prepared a complete Codeforces Round. You can check previous rounds, prepared by SIS students: Codeforces Round #612, Codeforces Round #530.

Codeforces Round #694 begins on 05.01.2021 17:35 (Московское время). In both redactions, there will be $$$6$$$ problems for $$$2$$$ hours. The round is rated for both divisions.

Problems are authored and prepared by AliceG, Pakhomovee, MadProgrammer, ArtNext, fastmath, IgorI, Kapt, KhB, Hello_zoka, Karabutsa, Arbuzniy_kekich, Mangooste, pelmenner, Allvik06 under the guidance of meshanya, cdkrot, kokokostya, kraborak, scanhex.

We would like to thank:

We recommend you to read the statements of all problems. Scoring will be announced later.

Good luck!

Scoring distribution is: $$$500 - 750 - 1000 - 1500 - 2000 - 2500$$$ in both divisions.

Editorial

System testing is over. Thank you for participating! We hope that you liked our problems!

Congratulations to the winners:

  1. tourist

  2. Petr

  3. jiangly

  4. Radewoosh

  5. ecnerwala

  6. Maksim1744

  7. lumibons

  8. Endagorion

  9. ainta

  10. DmitryGrigorev

  11. neal

All of them have solved problem E (with neal being the first). Problem F was quite challenging and no one have solved it during the contest.

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

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

Div.1 + Div.2 in the title is confusing, cuz it means combined round

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

I like blue! lol

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

    MadProgrammer is the impostor .lol

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

    ..Making us confused !! Nope, I can check all and make the scenario fool

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

      more formally : Brute force on the writers :D to check if he's blue or not

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

AliceG Топ!

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

Really like the blue color theme for this winter round!

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

    coders from the southern hemisphere

    :)

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

winter SIS (Summer Informatics School)

Hmmmm, there's something off here

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

Thank you for another blue round!

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

At first sight I thought there is a bug ,later realised it's "magic" lol

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

Thank you IgorI for preparing div.2 contest.

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

I am missing monogon.

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

BLUE

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

Should we change our handle blue in order to participate this contest?

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

Masters of the blue , of course meow will participate .

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

As a tester, 1-gon commented nothing!!!

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

BLUEFORCES :D

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

Meanwhile in the standings..

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

DIV 3 PROBLEM C VIDEO TUTORIAL LINK https://www.youtube.com/watch?v=7FFzXk-brRU I have tried my best to give you guys proper intuition of this dp problem. Hope you guys will enjoy this video !!!

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

18 "blue" authors and 1 real blue author, press F

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

    Some of us didn't author tasks, but helped with problem & the round preparation

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

It would be fun if testers were blue too.

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

    As a tester it's probably first time I feel nice about being Blue. Thanks to auth-orz.

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

Battle of Blue author

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

LOL !! It would be more interesting if Testers would also be Blue !! Would be a nice Combinations..

Participants should also need to change blue for participating LOL !!!

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

cf 693 1st question please help me , on what test case my code fails because I think that my code is right Its humble request thanks in advance

include <bits/stdc++.h>

using namespace std;

long long count(int n){ long long c=0; while(n%2==0){ n=n/2; c++; } return c; }

int main() {

int t;
cin >> t;
while (t-- > 0)
{
    int w, h;
    long long n;
    cin >> w >> h >> n;

    string s = "";

    if (n == 1)
    {
        s = "YES";
        //continue;
    }
    else if (w % 2 == 1 && h % 2 == 1)
    {
        s = "NO";
        //continue;
    }
    else if ((w % 2 == 0 && h % 2 == 1))
    { 

        long long x1 = 2*(count(w));
        if (x1 >= n)
        {
            s = "YES";
        }
        else
        {
            s = "NO";
        }
        //continue;
    }
    else if ((w % 2 == 1 && h % 2 == 0))
    {
        long long x2 = 2*(count(h));
        if (x2 >= n)
        {
            s = "YES";
        }
        else
        {
            s = "NO";
        }
        //continue;
    }
    else
    {   long long a1=2*(count(w));
        long long a2=2*(count(h));

        if (a1*a2 >= n)
        {
            s = "YES";
        }
        else
        {
            s = "NO";
        }
        //continue;
    }
    cout << s << endl;
}

return 0;

}

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

colourful standings

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

Hope to be blue color ^^

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

Is this BLUEFORCES ?

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

Really like this 'Authors in Blue' theme!!

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

much Expertise went into the problems' preparation

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

I literally freaked out on opening the contest page and seeing this blue brigade in there XD.

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

The face when I saw all the authors are blue.....

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

I'm glad all the cyans turned blue this year :D

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

Are you blue so that you can get girlfriend?

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

What a coordination among problem setters, All blue looking nyc

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

how do I cancel my registration from this contest? Does that really matters??

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

Last night I participated in a competition prepared by newbie, and tonight I will participate in a competition where the people who prepare the questions are all export. It is an interesting experience. ^__^

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

Seeing from a literary sense-blue colors all over the announcement symbolize the amount of tears testers and authors have shed while testing and creating the contest, so let us all do our job and participate to appreciate their hard work.

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

Blue , Blue & Blue. This is a bluish round.

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

It's not funny in the second time

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

I hope this round will make me the color I am now,but I'm more likely to turn blue...

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

Hope you guys do your best.

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

Authors are playing "among us".

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

As a LGM i love to attend this contest

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

I wish to become blue after this contest!

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

pog

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

Can we expect a magenta round next year?

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

Once in a Blue moon contest

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

i wnt psitive contribution please

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

why all the writers of this round have changed their id colour to blue? too much symmetry and why blue?

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

The comment is hidden because of too negative feedback, click here to view it

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

Roses are red, Violets are blue.

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

Well, that looks like new year's BLUE squad

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

Glad to see a blue brigade as problems co-ordinator. Hope to learn something new after this round. :P :))

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

Last contest I did really terrible so I cheated from my friend to not lose too much rating (I would never gain positive rating change from cheating )
Now I feel really terrible I never cheated before that was just very stupid and I'll never do that again even if I'm going to lose 200 I prefer to stay clean like how I always have been

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

    Glad to see u accepted your mistakes.

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

    I have not cheated in Codeforces but I guess you feel guilty and undeserving of the rating. Also codeforces is not a school exam, there is no obligation to participate, so cheating seems purposeless. Do well this round!

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

    MikeMirzayanov, ban him please

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

    you dont need to make public proclamations like this, just do not cheat.

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

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

Please update the scoring distribution??? Less than 1hr is left!!!

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

Ready

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

I hope everybody does well this round. I want to turn blue.

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

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

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

Second Contast of 2021 and oh boy i am excited for this one....Good Luck everyone and Bad Luck to the cheaters who try to ruin everything nice int this world. Codewarriorsssssssssssssss

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

The fact that only one of the 19 writers is actually blue! smh

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

A bit Queue in the submission

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

Such a long queue :(

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

It appears that I didn't register (I forgot to) to contest and can't submit, but the UI apparently forgets to tell me that is the case...

P.S. It's ok now

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

Strange contest!

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

is there any problem in server because submission taking time

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

Long queue

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

Has to be new record for difficulty gap between C and D in Div2.

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

the queue is 30 pages long. It's time for an unrated contest. :))

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

I think the long queue is because of the weak sample test.

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

Queue is too long. The round should be unrated.

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

lol people are asking to unrate the round just because they perform bad.

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

Queue way too long. Should be unrated

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

Its taking too much time for judge....

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

scrolling through the comments while 3rd problem in queue

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

Problem C was so easy!!! I should have solve that earlier in this contest! :(

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

    This always happens, I debate which one to gamble on and choose the harder one

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

It would have been really nice if the condition B > 10*C wasn't true. :)

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

difference between levels of C and D is very much i guess. anyway a good set of problems.thanks for the contest.

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

Is compilation error supposed to count as a wrong submission????

this is my submission log: https://imgur.com/oLZjnCZ

This is just my submission compared to someone else's on the leaderboard: https://imgur.com/BJZcjKu (if you look at the third person in the picture, they solved at same time as me, but I got 50 less points).

As you can tell, my compilation error cost me -50. Is this supposed to happen?

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

    You got -50 because of double "pretest passed", not because of compilation error

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

      Is that what is supposed to happen? They're both right, so why is that giving -50

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

        Because you basically replaced the previous submission which could contain a bug not caught in pretests. So it is the price for replacement.

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

          I personally don't think that should be -50 but ok. If it passed pretests but you caught something yourself, that's just a problem of pretests being weak, and therefore not your problem that it passed pretests. Nevertheless, it is whatever I did bad anyways. Thanks for clearing up my confusion

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

            After pretest, Codeforces will hold a system test, which will finally decides whether your submission is right or not. The resubmission is the function to avoid FST(Failed System Test), which will cause -50 penalty.

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

          Does this -50 happen for all cf contests? I just want to know for future reference

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

            Yes, as far as I know this is nothing new and is written somewhere in the rules

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

            A submission makes the previous AC submission counting like a failed one. This is for all constests, but not in all contests this results in -50 points. For example in educational rounds you get 5 or 10 points penalty.

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

    You got -50 because of the resubmission

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

maybe quene is long and maybe it is taking time to judge..but it is not in the position to make this contest unrated !!

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

** Placeholder for the picture "me after solving ABC" **

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

Div2D (Div1B) was amazing!!! The queue was irritating though

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

    what is the solution/hint, dont we just have to find answer for w=0, 1? what is wrong in that

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

      Yes, the answer for all w>=1 will be the same. So you have to look at just 2 cases.

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

        WHat is wrong in this, I stored, for each number, the product of prime factors with odd power taken once in a map. For example, for $$$4, 12, 3, 6$$$ we store them as $$$1, 3, 3, 6$$$ in map. Now key of $$$1$$$ gives already perfect squared, and value of $$$1$$$ in map will give single element count which become perfect square in first second. Now odd values in map will remain odd. Even values will get added to perfect squares component

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

          You maybe missed ans1=max(ans0,ans1) after calculating the answer for 1. This was the mistake i made and my idea is same as yours

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

            actually I mistook the statement of question :-(

            Each second the following happens: each element ai of the array is replaced by the product of all elements of the array (including itself)

            For singular elements as 6 is in case of [4,12,3,6] I multiplied it with itself to make it a perfect square after first second (facepalm)

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

    Can you please elaborate your approach ?

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

    HOw to solve B ? seemed easy but the idea did not struck

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

    How to solve it?

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

    I found it easy and mathy... I solved it by taking square-free part of numbers

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

    Could you please tell me why I am getting TLE? Actually I am never sure about how to use unordered_map without losing performance so if you could give me a few tips about that, that would be helpful.

    Submission: 103458851

    Variables-
    equi[x]: the ultimate value of x once all square elements are removed from it.
    equiCount[x]: a map to count occurrence of x
    initial: for w = 0, counts the maximum answer for initial setting.
    after: for w >= 1, counts the maximum answer once different elements are merged

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

After looking at problem D (Div 2).

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

B was so hard!

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

    You should analyse the frequence of numbers, then apply math.

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

In Div2D , 2nd test case after 1st second array becomes [36,36,8000,8000,8000,1] .

Now why is the answer 3 ?

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

    {8000,8000,8000} are adjacent to each other :P

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

      Are 8000 and 1 not adjacent ? lcm/gcd = 8000/1 = 8000 A Perfect Square

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

        Nope, 8000 is not a perfect square

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

          fuck. literally spent half an hour thinking why the hell is the answer not 4

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

            I lost a bit of time there as well — had it been a more obvious non-square-root, time could've been saved.

            The problem writers didn't (intentionally) give a lot of hints in this round, for any of the problems — most examples were quite basic and it was left for us to figure out the gotchas.

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

    [8000,8000,8000] — three adjacent elements [1,36,36] — also three

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

    there are 2 sets- [36, 36, 1] ans [8000, 8000, 8000] maximum size of any set is 3

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

    8000 = 2^6 * 5^3
    36 = 2^2 * 3^2
    1 = 1

    So 8000 is adjacent only to 8000.

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

How to solve D? I noticed, that the answer will be got either on first or second operation of counting the answer, but after that I got stuck.

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

    I was thinking like mapping each element to a number obtained by dividing the largest possible factor as square. Then elements mapped to same element are adjacent, now if the size of group is odd then this group could not be adjacent to any other group in next iterations otherwise such group in next iteration will be merged to other such even number group and group of elements mapped to 1. But not sure as I could not implement it in the time.

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

    $$$a$$$ is adjancet to $$$b$$$ only and only when its power prime divisors have same parity (3 = 2^0 * 3^1, 12 = 2^2 * 3^1 are adjancet).

    So all you need is factorize every number and count group by parity of prime powers. Then beauty is largest size of group.

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

      So, was it necessary to keep only different prime divisors? And what about the merging of other adjancet groups?

      UPD. Understood it. Thanks a lot.

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

        Merging will be only for group with even size and once as you posted. Then their product is perfect square. Otherwise group will never be changed.

        Let's say current group is (3, 12). Their product will be 36 — perfect square. And if group is (3, 12, 27) then their product is 972 = 3^5 * 2^2 (powers have same parity as 3 = 3^1 * 2^0, 12 = 3^1 * 2^2, 27 = 3^3 * 2^0, so it will be in the same group)

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

    Represent each number as a product of it's prime factors (but with each power modulo 2).

    For example: $$$540 = (2^2)*(3^3)*5$$$, so it will be represented as $$$(2^0) * (3^1) * (5^1) = 15.$$$ Hence each perfect square would be represented by 1.

    All numbers having the same representation will be adjacent at the $$$w = 0$$$ second

    And at $$$w = 1$$$ second only the representation having even counts will actually become perfect squares and thus merge into the representations of 1, and other representations will remain the same. Count the maximum among them

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

    *0th or 1st Notice that lcm(x,y)/gcd(x,y) = x * y / gcd(x,y)^2. That means that numbers are adjacent if their product is a square number. If they are square numbers, we don't really care about prime factors that appear even a number of times. So basically, divide numbers into groups, where every number in the group has the same "odd" prime factors. If the group is odd-sized, after the operation its size doesn't change. Otherwise, after the first operation, you can merge two even-numbered groups.

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

Did anybody face 'Idleness Limit Exceeded' in Div. 2 D for not flushing cout, or was it just me?

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

    Same when doing practise- -

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

    That's pretty weird to me, I got Accepted by changing cin to scanf.

    [Accepted] Use scanf: code

    [Idleness limit exceeded on test 3] Use cin with ios::sync_with_stdio(false): code

    Does anyone know why?

    I am using int to read long long cause the issue..

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

      Yeah, it worked when I changed endl to "\n". Strange.

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

Div1 C deserved way more points than Div1 D :(

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

How to approach C problem? I didn't understand the samples.

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

    Same, I spent a lot of time, thinking what the hell with samples.
    Idea what we can use another distribution than in samples, like (from the second example)

    * A present that costs 10 dollars to the first friend.
    * A present that costs 40 dollars to the second friend.
    * 10 dollars to the third friend.
    * 40 dollars to the fourth friend.
    * 90 dollars to the fifth friend.
    

    I solved by two prefix sums (gift prices and sorted costs to pay to friends). And we try to find how many elements with paid friends we can replace with gifted (gifts from start (from cheapest)). Trying to find the edge of the minimum total price. It's kinda difficult to explain.
    103452905
    Possibly it is not the most obvious solution.

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

    sort the 1st array in decreasing order ..then iterate every element for every elem i,take min(ith elem,arr[i]th elem)

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

The difficulty difference between div 2 C and D was way too much :(

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

Weak test cases of C

103437395 (should be WA , but AC)

103459710 (This is correct)

UPD : My mistake sorry :( , but still i m not able to figure out why both are correct

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

    the gifts are sorted in ascending order so it doesn't matter

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

    its correct, i mean first link answer is not wrong.

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

      No you are wrong :)

      1

      11 2

      1 1 1 1 2 2 2 2 2 3 3 3

      2 4

      The first solution gives 28, while the correct answer is 27 which given by the second solution

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

    this is the verdict before system tests

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

    n = 11 but in your test case you have taken 12 elements.

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

(After Contest) How to solve Div2 C? Silly me couldn't solve it even after an hour of thinking.

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

In problem D , I thought answer will be same in each query and adjacent property will be transitive .Got WA on test 2 , maybe i missed something .

I stored frequency of a[i]/(j*j) if a[i] is divisible by j*j .Maximum frequency will be answer .

could someone tell whats wrong in approach or solution

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

nvm, got it

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

Div2 D was tough but it is really awesome problem I guess.

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

1) I think Div2D can be solved using Prime Factorization. (Correct me if I am wrong). time complexity will be around O(N*sqrt(Amax)). 2) I think you will get maximum possible answer in second 1. so we have to calculate answer for second 0 and 1.

I don't know what I missed but, failed pretest 2.

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

    You miscalculated answer for second 1, you include even component size ones as well as ones which are perfect squares already, and also take maximum with odd frequency ones also.

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

    I don't think that complexity passes, I got TLE. Might just be me being an idiot though.

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

The problems were really interesting but I think the problem statement of Div.2 B could have been better. It took me 30 min alone to fully understand the statement correctly.

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

I passed sample of E in 10 seconds after the match, f**k the long queue!!!

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

The problems were nice but the queue was awfully long:(

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

Oh in problem F I didn't consider the case when two rectangles form a cross, ready to FST, so sad :(

But, how could this pass pretests..?

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

the requirements for the solution for Div1D/Div2F don't have any sense!

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

How to Solve Div2 D?

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

Cheaters everywhere!

Screenshot-2021-01-05-22-43-40-872-org-telegram-messenger

Screenshot-2021-01-05-22-43-44-269-org-telegram-messenger

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

    Waiting for the obligatory mass cheating blog.

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

    we dont give a f*ck, why are u posting this? spoils the mood tbh.

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

    We know about this chat and all cheaters will be banned

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

    Lol they blocked me after I told them 2-3 eye-opening lines XD

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

There was long queue throughout this contest we had to wait for 2 minutes to get to know whether our code passed pretests or not . My last submission although passed pretests but there is negligible chance of it passing the final test because it took 1965ms where maximum time allowed was 2000ms. I think I could have modified it easily if I had got 5 more minutes which got lost due to this queue . The Coordinators should have Increased the time by 15 min to compensate for the long queue. Anyways keeping aside the result This was a great contest. A,B,C were good . D was quite Tricky

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

Interesting problems!Thanks to everyone who contributed!But testing was weak. :(

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

Hi! Is it possible to hack codes?

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

I highly suspect the data of DIV 2 C is wrong, that is, in pretest three, the ci's are not ranked from the smallest to largest. Anyone share the same idea?

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

    They are in ascending order, please read the question carefully

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

      Yeah they should be, but I doubt in pretest 3 they are not

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

        Hmm...I got all the pretests passed, did your code failed for 3?

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

          Yeah, and I compared it with the passed code, and our code are different if and only if the costs are not sorted

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

            Can you show both codes?

            I will give you 20 euros if what you say is exactly true.

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

              This is the passed code

              #include <bits/stdc++.h>
              using i64 = long long;
              using u64 = unsigned long long;
              using u32 = unsigned;
              int main() {
                  std::ios::sync_with_stdio(false);
                  std::cin.tie(nullptr);
                  int t;
                  std::cin >> t;
                  while (t--) {
                      int n, m;
                      std::cin >> n >> m;
                      std::vector<int> k(n);
                      for (int i = 0; i < n; i++) {
                          std::cin >> k[i];
                          k[i]--;
                      }
                      std::vector<int> c(m);
                      for (int i = 0; i < m; i++) {
                          std::cin >> c[i];
                      }
                      std::sort(k.begin(), k.end());
                      i64 ans = 0;
                      for (int i = n - 1; i >= 0; i--) {
                          ans += c[std::min(k[i], n - 1 - i)];
                      }
                      std::cout << ans << "\n";
                  }
                  return 0;
              }
              

              And this is my code

              #include <bits/stdc++.h>
              using namespace std;
              typedef long long LL;
               
              int main(){
              	int tt;
              	cin >> tt;
              	while(tt --){
              		int n, m;
              		cin >> n >> m;
              		vector<int> a(n);
              		vector<LL> b(m);
              		for (int i = 0; i < n ; i++){
              			cin >> a[i];
              			a[i] --;
              		}
              		for (int i = 0; i < m; i ++){
              			cin >> b[i];
              		}
              		sort(a.begin(), a.end(), greater<int>());
              		int curr = 0;
              		LL res = 0;
              		for (int i = 0; i < n ; i ++){
              			res += min(b[i], b[a[i]]);
              		}
              		cout << res << endl;
              	}
              }
              

              I guess I can't get this 20 euro but I would also be grateful if you could point out my error :)

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

                In the last for loop you are using b[i] which is wrong because i < n

              • »
                »
                »
                »
                »
                »
                »
                »
                5 months ago, # ^ |
                  Vote: I like it +5 Vote: I do not like it
                vector<LL> b(m);
                //...
                for (int i = 0; i < n ; i ++){
                    res += min(b[i], b[a[i]]);
                }
                

                Some out of bounds lies here...

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

        If you are saying things like "test data is wrong" without even seeing the test, you better have a very good reason. It is far more likely that you did something wrong. Especially since a ton of people have solved it.

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

In Div2C, Totally missed that the cost array was sorted. Made a segment tree ;_; . (Link 103478099)

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

    me too, but i knew that since its div2c , theres no way the answer is a segment tree, so i kept reading the question again and again, and sent a question(Answer was "read the problem statment").
    The statement should have made it more clear, at least in writing.
    wasted too much time ;(

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

Can anyone explain 1st question?

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

A- pretests passed(3)..... WA on test 4 :))))) and my day is spoiled.

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

??? why pretest A was too weak so many contestants was hacked

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

    someone probably leaked the wrong solution
    whoever did that, u have my respect!!!

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

      Not really. Many failed due to precision error of floating point ceil func in C++. Seems quite natural to me.

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

    Not getting hacked is not a universal human right or something.

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

    Due to integer over flow my code failed for A

    I realized after contest finished

    I have to change int max_bty,min_bty to long long int max_bty,min_bty Silly mistake

    But i wonder how integer overflow occurs even constrains says sum of all elements won't exceed 10⁵

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

      If you read the question carefully, it says the sum of the values of "n" don't exceed 10^5. It doesn't place any restriction on the values of array itself. It is only on the number of elements in the testcase. Due to this, you can have a testcase which has 10^5 elements, each of which are 10^9 which easily overflows in your case.

      I hope it clears up things for you.

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

      I could solve only B in the contest. Got wrong answers when I submitted A and C. Just tried A and C with replacing int by long long and both got accepted.

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

Thanks for an interesting problem set. Wish there was a little extra time due to problems with the queue.

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

what happen Problem A's TC 4

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

I learned ceil for integers by a hard way today.

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

Why is my solution for D still showing pretest passed instead of in queue?

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

    Because it passed the system tests :)

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

      Emmm... I didn't get points for that problem.

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

        wait what.. I guess it didn't even get into the queue for system tests yet.

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

How can we have all that queue without even increasing the time of the contest?!!!!!!

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

Thought the blue color was the theme of this contest, turns out it s absolutely red!

RIP c++ contestants on problemA div2 xDxD

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

    why what happened?

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

      take a look on status! lot of cpp submissions failed system tests on problem A.. mine included xD..

      I guess it has something to do with the function ceil.

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

        I think I have never used ceil. Don't use ceil, in fact try to not use floats unless absolutely necessary. You can do most things with integers, for example (p + q - 1) / q calculates $$$\left \lceil \frac{p}{q} \right \rceil$$$.

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

          coool thankies

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

          To find the a/b rounded up to the nearest integer, can't we use if(a%b==0) ans=a/b; else ans=(a/b)+1; ?

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

            I assume you can use many things to do that.

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

              Oh never mind, I thought my solution failed due to that but the reason was something else.

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

            Your conditional statement is the same as (a+1)/b + 1 which also equals the (p+q+1)/q. Not sure if one is faster than the other. I'm generally more scared of overflow, so I use mine ... but I'm not red, so do whatever.

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

        Pffff.... I always thought that this is one of first things you learn in c++ contests:

        1) Beware of overflow;
        2) Beware of UB (overflow is one of case of UB but sometimes it is not and it is too common problem);
        3) Beware of using floating-point functions where it's not necessary.

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

          I guess I learned it the hard way... But still I learned it xD

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

        It's actually because of 1e+10 output format if you don't cast the result to integer

        Quite annoying.

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

    Why are you blaming c++?

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

    BUT WHYYY?????????????????????????

    System Failed Error.

    when everything works perfectly!

    Also, this C++ code uses Ceil and also accepted

    https://codeforces.com/contest/1471/submission/103394434

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

      You failed because you output 1e+10 (see your submission)

      In passed ceil result was cast to integer type. But I think maybe this is still hackable due to floating point operations. This is rule — never use them :)

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

    You can typecast it to double and then use 'ceil', eg: b = ceil((double)y/x);

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

Thanks for strong pretests in B.

I used int on w then it passed pretests.

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

    I did the same and it failed pretests :o

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

      I think he is talking about div1B.

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

        I was also talking about div1B lol

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

I've just realized that div1C is a perfect task to do while(1) when you run out of queries.

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

Fastforces

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

My simplest solution to Div.1C :

Randomly choose an index and check if its value is not k. When we find such index, break.

If value is more than k, keep going left else keep going right till we find k.

Is it hackable ?

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

Why you guys did weak pretests to Div.1 D, not funny

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

    Also thank you for very stong pretests on problem C, now I will lose all my rating, worst prepared contest ever

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

VIDEO TUTORIAL FOR DIVISION 2 PROBLEM B AND C Link of problem B :https://www.youtube.com/watch?v=e7N8N1GlSOc Link of problem C : https://www.youtube.com/watch?v=rj1A1N7yVkM HOPE YOU GUYS WILL ENJOY THE VIDEO !!!

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

When you are about to get +230, but you don't believe your solution on D so you did 100 random iterations of the greedy (just 1 iteration passes) and then it exceeds the time limit in system tests

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

In div1C when I was stressing the solution of one guy from my room, he had like $$$\frac{1}{10}$$$ chance to ask too many queries and it passed o.O

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

Why Problem A of Div 2 throws SYSTEM FAILED ERROR in my and many many other submissions?

MY CODE: https://codeforces.com/contest/1471/submission/103394142

It's throwing WA in TEST 4. BUT WHY??????

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

    cout<<(ll)ceil((sum * 1.0) / x)<<" "<<sum2<<endl; it gives you OK

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

    Typecast your answer int INT, ceil function returns double, which has a floating point precision of 10 digits, so any number greater than that is represented in exponential form.

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

Hi, my submission 103400375 didn't enter the main test queue due to some reason. Please check it and rectify MikeMirzayanov. Thanks to the user old_school for pointing this out!

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

Good job!

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

Thanks for LOTS OF STRONG pretests.

The Problem. C,we can only read 2 integers,and there are only 6 pretests?

for(int i=1;i<=501;++i)ask(1);
if(n<=980){
	static int b[10066];
	for(int i=1;i<=n;++i)b[i]=ask(i);
	for(int i=1;i<=n;++i)if(b[i]==k&&b[(i==1?n:i-1)]<k)
	give(i);
}

This is a part of my code. I just made a mistake(980 is too big) but it can pass the pretests.

So what are these pretests for?

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

    Not that strong pretests are good for hacking, but just 6 weak pretests went too far

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

    Queue would have been very long if there were more pretest. Could have made round unrated. It was prefect amount of pretests for maximum participation. But the pretests in itself could have been stronger. Like adding test cases could have solved this problem.

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

    No way, 6 weak pretests is just too bad

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

why systest on E so slow :(

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

Best of the best)

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

Got fst for 2 problems... I think today's pretests are kind of weak.

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

Since I got WA on problem A, do anyone know a fast way to write ceil(ll a/ll b) on large integers?

  • »
    »
    5 months ago, # ^ |
    Rev. 2   Vote: I like it +1 Vote: I do not like it
    a / b + !!(a % b);
    

    a / b — round down
    a % b — remainder
    !!(a % b) — cast a % b to bool (0 if a % b == 0, 1 otherwise)

    So full expression is $$$\lfloor a / b \rfloor + (1 \ if\ a\ mod\ b \neq 0, 0\ otherwise) = \lceil a / b \rceil$$$

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

    Use (a + b - 1) / b instead of ceil function

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

    ceil(a/b)=floor((a+b-1)/b)

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

      Don't forget to typecast (long long) in front of floor function. I learned it the hard way.

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

        There is no need to typecast as it is a simple division without using function floor.

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

          But you have written a floor in your formula. I was replying to that. I know that it can be done with simple division. I got FST in Q1 because I wrote floor unnecessarily. That's why I pointed out. Nothing much!

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

    (long long)ceil((double)a / b)

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

Bleed Blue!

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

I feel like I am higher in the rankings than I should be, even though I had 3 failed submissions on problem D. Is there a reason for this?

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

I feel sad for what happened to rainboy

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

Darn I got 2 TLEs on Div 2C before I used the input optimization (ios_base...). Even my O(N) solution failed because of that. They really just had to make it N=3*10^5.

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

I spent a few minutes debugging div2e and solved it after the game. But I couldn't finish it in the game, even though my idea was right. What a sad story. .

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

1471A - Странный массив 103405431 103466071 I used a simple (int) to convert a fraction to integer. How I even got an negetive value ? Is it fault of server ? cause removing (int) gives correct ans and int is virtually just converting or typecasting fraction to integer.

wrong answer 13th numbers differ — expected: '3333333334', found: '-961633962'

This should not be there . Please correct me if I am wrong. [user:300iq][user:IgorI]

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

    I think you have overflow

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

      here: mi = (int)(mi/x)+1;

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

        I don't thing that is the case since ma is also int .... and values are almost equal plus many people used int when declaring the variable .I suspect system's fault.

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

To not keep you waiting, the ratings updated preliminarily. In a few hours, I will remove cheaters and update the ratings again!

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

Damn! Never knew using float instead of double could be this costly. In problem A, my code (103399047) failed test case 4 (wrong answer 9th numbers differ — expected: '11', found: '10'). I thought long long divisions could be handled by float. Does the same happen with anyone else ?

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

    In general, it's better to avoid using float or double when it's not necessary. It's way safer to just make your own simple ceildiv function.

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

    float is type which store at most 9 decimal digit precisely. So not all 64bit numbers could be hold.

    And yes, in status you can see that you are way not alone

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

    always do (a+b-1)/b for the ceil of a/b

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

I found problem F very unclear. Is like the first condition contradicts the third:

  1. All passages between two houses will be closed, if there are no teachers in both of them.

it means that if an edge doesn't have both vertices with a teacher, the edge is closed?

but the third condition says:

  1. does it means that the open edges are the ones with at least one teacher?

Was the intention that open edges are the ones with at least one teacher in one of its vertices?

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

    open edges are the ones with exactly one teacher in one of its vertices. I agree though, it was unclear for me as well. Had to read 4-5 times.

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

    yeah the statement could have been worded better.took me a lot of time to understand what they meant.

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

    I asked for clarification of the third condition, then I get:

    • Read the problem statement
    • the explanation for the first condition without any word about the third, even not say "it explanation for what."
    • No comments

    So I can only get what it means when I successfully guess what it means.

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

it was a bad contest.

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

In Div1B , I am getting WA on TC 44 , but its working on online and local compiler correctly. Can someone please help me with what is the error. Thanks!

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

    w can overflow int

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

      my int is defined as long long , so that isn't the reason I think

      • »
        »
        »
        »
        5 months ago, # ^ |
          Vote: I like it +9 Vote: I do not like it
                    for(auto &x : m)
                    {
                        if(x.ff==1) continue;
                        if(x.ss%2==0)
                        {
                            m[1]+=x.ss;
                            v.pb(x.ff);
                        }
                    }
        

        Too bad idea change container white iterating over it with range-based loop.

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

          Thank you so much , but can you tell me why this happens ?

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

            You there have unordered map.
            What happens when inserts new element (index access can do this)? There is checking if there is need of rehashing (map size is gonna be greater than $$$m.max\_load\_factor() * m.bucket\_count()$$$ ). If rehashing is needed then all buckets are cleared hence all iterators are invalidated now.

            So in your cycle body $$$x$$$ is reference to value lies under iterator which is currently not valid anymore. And before next iteration there is try to increment invalid iterator which implies UB.

            Why it is only WA#44? Because UB is almost never predicted;) But maybe at most small tests there was perfect square in test data and there is no invalidation and with others rehashing is no needed.