IgorI's blog

By IgorI, history, 4 years 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 Jan/05/2021 17:35 (Moscow time). 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, ligaydima, Mangooste, pelmenner, daubi under the guidance of meshanya, cdkrot, kokokostya, craborac, 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. gop2024

  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

| Write comment?
»
4 years 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

»
4 years ago, # |
  Vote: I like it +60 Vote: I do not like it

I like blue! lol

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

    MadProgrammer is the impostor .lol

  • »
    »
    4 years 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

    • »
      »
      »
      4 years 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

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

AliceG Топ!

»
4 years ago, # |
  Vote: I like it +31 Vote: I do not like it

Really like the blue color theme for this winter round!

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

    coders from the southern hemisphere

    :)

»
4 years ago, # |
  Vote: I like it +151 Vote: I do not like it

winter SIS (Summer Informatics School)

Hmmmm, there's something off here

»
4 years ago, # |
  Vote: I like it +32 Vote: I do not like it

Thank you for another blue round!

»
4 years 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

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

I am missing monogon.

»
4 years ago, # |
  Vote: I like it -10 Vote: I do not like it

BLUE

»
4 years 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?

»
4 years ago, # |
  Vote: I like it +13 Vote: I do not like it

Masters of the blue , of course meow will participate .

»
4 years ago, # |
  Vote: I like it +34 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +41 Vote: I do not like it

BLUEFORCES :D

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

Meanwhile in the standings..

»
4 years ago, # |
  Vote: I like it +98 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +380 Vote: I do not like it
  • »
    »
    4 years 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

»
4 years ago, # |
  Vote: I like it +34 Vote: I do not like it

It would be fun if testers were blue too.

  • »
    »
    4 years 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.

»
4 years ago, # |
  Vote: I like it +6 Vote: I do not like it

Battle of Blue author

»
4 years 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;

}

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

colourful standings

»
4 years ago, # |
  Vote: I like it +38 Vote: I do not like it

Is this BLUEFORCES ?

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

Really like this 'Authors in Blue' theme!!

»
4 years ago, # |
  Vote: I like it +23 Vote: I do not like it

much Expertise went into the problems' preparation

»
4 years 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.

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

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

»
4 years ago, # |
  Vote: I like it +10 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +35 Vote: I do not like it

Are you blue so that you can get girlfriend?

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

What a coordination among problem setters, All blue looking nyc

»
4 years 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??

»
4 years 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. ^__^

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

It's not funny in the second time

»
4 years 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...

»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

Hope you guys do your best.

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

Authors are playing "among us".

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

I wish to become blue after this contest!

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

pog

»
4 years ago, # |
  Vote: I like it +2 Vote: I do not like it

Once in a Blue moon contest

»
4 years ago, # |
  Vote: I like it +62 Vote: I do not like it

i wnt psitive contribution please

»
4 years 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?

»
4 years 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

»
4 years ago, # |
  Vote: I like it +17 Vote: I do not like it

Roses are red, Violets are blue.

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

Well, that looks like new year's BLUE squad

»
4 years 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 :))

»
4 years 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

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

    Glad to see u accepted your mistakes.

  • »
    »
    4 years 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!

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

    MikeMirzayanov, ban him please

  • »
    »
    4 years 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.

»
4 years ago, # |
  Vote: I like it +24 Vote: I do not like it

»
4 years ago, # |
  Vote: I like it +29 Vote: I do not like it

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

»
4 years 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).

»
4 years ago, # |
  Vote: I like it +12 Vote: I do not like it

A bit Queue in the submission

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

Such a long queue :(

»
4 years 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

»
4 years ago, # |
  Vote: I like it +23 Vote: I do not like it

Strange contest!

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

is there any problem in server because submission taking time

»
4 years ago, # |
  Vote: I like it -20 Vote: I do not like it

Long queue

»
4 years 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.

»
4 years 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. :))

»
4 years 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.

»
4 years ago, # |
  Vote: I like it -145 Vote: I do not like it

Queue is too long. The round should be unrated.

»
4 years 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.

»
4 years ago, # |
  Vote: I like it -94 Vote: I do not like it

Queue way too long. Should be unrated

»
4 years ago, # |
  Vote: I like it -71 Vote: I do not like it

Its taking too much time for judge....

»
4 years ago, # |
  Vote: I like it -26 Vote: I do not like it

scrolling through the comments while 3rd problem in queue

»
4 years 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! :(

  • »
    »
    4 years 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

»
4 years 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. :)

»
4 years 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.

»
4 years 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?

  • »
    »
    4 years 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

    • »
      »
      »
      4 years 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

      • »
        »
        »
        »
        4 years 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.

        • »
          »
          »
          »
          »
          4 years 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

          • »
            »
            »
            »
            »
            »
            4 years 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.

        • »
          »
          »
          »
          »
          4 years 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

          • »
            »
            »
            »
            »
            »
            4 years 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

          • »
            »
            »
            »
            »
            »
            4 years 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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You got -50 because of the resubmission

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

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

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

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

  • »
    »
    4 years 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

    • »
      »
      »
      4 years 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.

      • »
        »
        »
        »
        4 years 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

        • »
          »
          »
          »
          »
          4 years 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

          • »
            »
            »
            »
            »
            »
            4 years 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)

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    How to solve it?

  • »
    »
    4 years 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

  • »
    »
    4 years 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

»
4 years ago, # |
  Vote: I like it +48 Vote: I do not like it

After looking at problem D (Div 2).

»
4 years 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 ?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      4 years 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

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

        Nope, 8000 is not a perfect square

        • »
          »
          »
          »
          »
          4 years 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

          • »
            »
            »
            »
            »
            »
            4 years 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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

  • »
    »
    4 years 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

  • »
    »
    4 years 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.

»
4 years 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.

  • »
    »
    4 years 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.

  • »
    »
    4 years 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.

    • »
      »
      »
      4 years 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.

      • »
        »
        »
        »
        4 years 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)

  • »
    »
    4 years 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

  • »
    »
    4 years 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.

»
4 years 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?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Same when doing practise- -

  • »
    »
    4 years 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..

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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

»
4 years ago, # |
  Vote: I like it +17 Vote: I do not like it

Div1 C deserved way more points than Div1 D :(

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

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

  • »
    »
    4 years 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.

»
4 years 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 :(

»
4 years 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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      4 years 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

      • »
        »
        »
        »
        4 years ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        oh yeah if (j < m && j < a[i]-1) should be there i guess

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    this is the verdict before system tests

»
4 years 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

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

nvm, got it

»
4 years ago, # |
  Vote: I like it +8 Vote: I do not like it

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

»
4 years 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.

  • »
    »
    4 years 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.

  • »
    »
    4 years 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.

»
4 years 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!!!

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

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

»
4 years 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..?

»
4 years 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!

»
4 years 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

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

    Waiting for the obligatory mass cheating blog.

  • »
    »
    4 years 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.

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

    We know about this chat and all cheaters will be banned

  • »
    »
    4 years 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

»
4 years 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

»
4 years ago, # |
  Vote: I like it +3 Vote: I do not like it

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

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

Hi! Is it possible to hack codes?

»
4 years 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?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    They are in ascending order, please read the question carefully

    • »
      »
      »
      4 years 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

      • »
        »
        »
        »
        4 years 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?

        • »
          »
          »
          »
          »
          4 years 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

          • »
            »
            »
            »
            »
            »
            4 years 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.

            • »
              »
              »
              »
              »
              »
              »
              4 years 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 :)

              • »
                »
                »
                »
                »
                »
                »
                »
                4 years 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

              • »
                »
                »
                »
                »
                »
                »
                »
                4 years 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...

      • »
        »
        »
        »
        4 years 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.

»
4 years 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)

»
4 years 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.

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

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

  • »
    »
    4 years 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!!!

    • »
      »
      »
      4 years 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.

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

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

  • »
    »
    4 years 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⁵

    • »
      »
      »
      4 years 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.

»
4 years 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.

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

what happen Problem A's TC 4

»
4 years ago, # |
  Vote: I like it +12 Vote: I do not like it

I learned ceil for integers by a hard way today.

»
4 years 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?

»
4 years 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?!!!!!!

»
4 years 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

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    why what happened?

    • »
      »
      »
      4 years 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.

      • »
        »
        »
        »
        4 years 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$$$.

      • »
        »
        »
        »
        4 years 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.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Why are you blaming c++?

  • »
    »
    4 years 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.net/contest/1471/submission/103394434

    • »
      »
      »
      4 years 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 :)

»
4 years 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.

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

    I did the same and it failed pretests :o

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

      I think he is talking about div1B.

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

        I was also talking about div1B lol

»
4 years 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.

»
4 years ago, # |
  Vote: I like it +11 Vote: I do not like it

Fastforces

»
4 years 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 ?

»
4 years 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

  • »
    »
    4 years 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

»
4 years 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

»
4 years 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

»
4 years 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.net/contest/1471/submission/103394142

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

  • »
    »
    4 years 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

  • »
    »
    4 years 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.

»
4 years 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 osLivedHere for pointing this out!

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

Good job!

»
4 years 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?

  • »
    »
    4 years 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

  • »
    »
    4 years 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.

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

    No way, 6 weak pretests is just too bad

»
4 years ago, # |
  Vote: I like it +90 Vote: I do not like it

why systest on E so slow :(

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

Best of the best)

»
4 years 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.

»
4 years 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?

  • »
    »
    4 years 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$$$

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

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

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

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

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

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

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

Bleed Blue!

»
4 years 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?

»
4 years ago, # |
  Vote: I like it +33 Vote: I do not like it

I feel sad for what happened to rainboy

»
4 years 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.

»
4 years 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. .

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

1471A - Strange Partition 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]

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think you have overflow

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

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

      • »
        »
        »
        »
        4 years 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.

»
4 years 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!

»
4 years 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 ?

  • »
    »
    4 years 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.

  • »
    »
    4 years 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

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

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

»
4 years 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?

  • »
    »
    4 years 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.

  • »
    »
    4 years 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.

  • »
    »
    4 years 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.

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

it was a bad contest.

»
4 years 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!

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    w can overflow int

    • »
      »
      »
      4 years 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

      • »
        »
        »
        »
        4 years 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.

        • »
          »
          »
          »
          »
          4 years ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

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

          • »
            »
            »
            »
            »
            »
            4 years 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.

            • »
              »
              »
              »
              »
              »
              »
              4 years ago, # ^ |
                Vote: I like it 0 Vote: I do not like it

              Thank you so much , got it . Will be careful from next time ;)

»
4 years ago, # |
  Vote: I like it +14 Vote: I do not like it

Missed div1C by two characters...

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

Thank you cf to yet again remind me to no never use float even in my dreams

»
4 years ago, # |
  Vote: I like it +1 Vote: I do not like it

Aw I really thought I would reach pupil this round, welp better luck next contest

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

How do I find the answers in problem D without integer overflow?

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

Could someone please tell me why I am getting TLE for Div2D (Div1B)?
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

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.

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

Does someone have an explanation as of why my submission Replacing unordered_map with vector is getting TLE, but this one using unordered_map with the exact same code is not..!

I have just changed the hashing container..

If memory was a concern..i should have got RTE. But TLE is kinda strange.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The limit of testcase $$$t$$$ is $$$10^5$$$ and you are initializing a vector of length $$$10^6$$$ with $$$0$$$ in each test case and its time complexity is $$$O(N)$$$

    • »
      »
      »
      4 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Oh correct! That really helped. Thanks a lot!

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

Can anyone figure why this code is getting mle on test 21 ( Div2 :Problem F)

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

The contest(problems) was really good, but I didn't like sample tests(they are too stupid).

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

strange contest

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

ok Position 4 is guessed successfully (n = 2, k = 1) with 5 queries

Above is the content of di1C/div2E test 70 checker log, and there are something really confuse me. Shouldn't k be an even number and p is less than or equal to n?

  • »
    »
    4 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I suppose that variables are mixed up in checker logs for this problem. See other logs, everywhere they are like this: ok Position $n is guessed successfully (n = $k, k = $p) with $some queries (An input line of the judgement protocol contains 3 numbers and these might be n, k, p in that order)