Блог пользователя Ari

Автор Ari, история, 5 лет назад, По-английски

Hi Codeforces!

We are happy to invite you to take part in Codeforces Round 561 (Div. 2). The contest will be held on May/17/2019 18:05 (Moscow time).

You will be given 6 problems and 2 hours to solve them. The round will be rated for all contestants with rating below 2100. As usual, participants from the first division are welcome to join out of competition.

The problems were written and prepared by Jefe and me. We owe a huge thanks to KAN for coordinating the round, to Lewin and mohammedehab2002 for testing, and of course, to MikeMirzayanov for the great Codeforces and Polygon platforms.

Good luck and have fun!

UPD: A huge thanks to neal, dreamoon_love_AA, and antguz for help with additional testing.

UPD2: Thanks for participating! System tests have finished. Congratulations to our winners!

Div. 2

  1. iristran911

  2. Sigyn

  3. HaylayWilliams

  4. albertg

  5. Tianhen

Div. 1 + Div. 2:

  1. 244mhq

  2. Um_nik

  3. uwi

  4. iristran911

  5. HIR180

Editorial will be available soon.

UPD3: Editorial is up!

  • Проголосовать: нравится
  • +348
  • Проголосовать: не нравится

»
5 лет назад, # |
  Проголосовать: нравится +44 Проголосовать: не нравится

A lot of rounds recently! That is awesome!

»
5 лет назад, # |
  Проголосовать: нравится -20 Проголосовать: не нравится

Hope I become CM after this round.

»
5 лет назад, # |
  Проголосовать: нравится -57 Проголосовать: не нравится

Hope it will be harder than before

»
5 лет назад, # |
  Проголосовать: нравится -8 Проголосовать: не нравится

i wish i could solve 2 or more problems this time :)

»
5 лет назад, # |
  Проголосовать: нравится +33 Проголосовать: не нравится

hope is a good thing..

»
5 лет назад, # |
  Проголосовать: нравится +29 Проголосовать: не нравится

I Hope the statement will be short and nice like the announcement .

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
5 лет назад, # |
  Проголосовать: нравится -26 Проголосовать: не нравится

round done by weeb... ... ..... .. ....... .... ... i am scared to try it!!

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    How come you haven't been blocked yet? I intentionally commented about 10 bad comments and Codeforces already threatened me.

»
5 лет назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

Oh Mexico Round SMT new

»
5 лет назад, # |
  Проголосовать: нравится -28 Проголосовать: не нравится
  • »
    »
    5 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    Это конечно хорошо, 21 век на дворе и так далее, но к чему это на этом сайте? или это тонкий юмор?

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится -24 Проголосовать: не нравится

      о каком юморе идет речь?

      • »
        »
        »
        »
        5 лет назад, # ^ |
          Проголосовать: нравится +4 Проголосовать: не нравится

        так и я не знаю, очевидно что-то мне непонятное с кф-ом? ибо как объяснить положительный рейтинг комментария ни коим образом не относящегося ни к этому посту, ни к этому сайту. Будем флудить разными поздравлениями дальше?

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится -7 Проголосовать: не нравится

    так ты же гей.................

»
5 лет назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

Is there any plan to announce the scoring distribution?

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Thanks for div2. I want to be Master.

»
5 лет назад, # |
  Проголосовать: нравится -21 Проголосовать: не нравится

I know , U know, what if I told u...

»
5 лет назад, # |
  Проголосовать: нравится +68 Проголосовать: не нравится

I will try to do screencast with live commentary in English. If everything will go smoothly, you will be able to check it out on my YouTube channel some time after the round. Warning: English will be bad.

»
5 лет назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

So what's the score for each problem?

»
5 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

where is score distribution

»
5 лет назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

1166C - A Tale of Two Lands remind me of gravity falls :D

»
5 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

I was glad that the problems seemed good to me, but actually from my extra registration I can't submit my code, and it just alerts "You have submitted exactly same code before", though I didn't succeed to submit anything... Lost the chance to climb up qwq

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Good Contest.

»
5 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

TestCase 12 for C?

»
5 лет назад, # |
  Проголосовать: нравится +16 Проголосовать: не нравится

Yay! A chance to be master if system tests won't reject me :P

»
5 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

Mathforces???????????????????????????????????

»
5 лет назад, # |
  Проголосовать: нравится +35 Проголосовать: не нравится

I need proof for E

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    How to solve E?

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Necessary condition for the solution to exists is : Any two days must have a store in common.

      Seems like, it is the sufficient condition too.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      This is really intuitive solution, which I came up with in last five minutes: iff there's any element that are contained in all $$$m$$$ days, you can make the number extremely big prime so that you will get larger LCM. Is it true?

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится +13 Проголосовать: не нравится

      Check if for any $$$2$$$ different days sets of shops Dasha visited have nonempty intersection

      But I don't know how to prove that it's a sufficient condition

      Actually, I just submitted that because I saw how much people got it accepted, so it has to be something really stupid O_o

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +62 Проголосовать: не нравится

    Let's take $$$m$$$ different primes, one for each query. Start with array of 1, and then multiply all the numbers in one query by the prime of this query. In each query LCM of our numbers will be product of all primes and LCM of all other numbers will lack prime of this query.

    Of course, this is true when all queries are pairwise intersecting.

  • »
    »
    5 лет назад, # ^ |
    Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

    If there exist two disjoint sets, answer is obviously no. If every pair has common element we can do the following: First set all numbers to one. Lets consider one set: a1,a2...aS. We may multiplay all numbers a1,a2...aS by arbitrary large prime number. It will guarantee us that this set is correct. On the other hand, we dont make our situation worse, for other sets(days), i think it is clear why ( from definition of LCM).

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +2 Проголосовать: не нравится

    If on any day the set of stores visited by Dora is a subset of the set of stores visited by Swiper on any other day then it is impossible, else it is possible.

»
5 лет назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

ALL THE PROBLEMS WERE BEAUTIFUL EXCEPT FOR C

»
5 лет назад, # |
  Проголосовать: нравится +20 Проголосовать: не нравится

D is hard to implement.

»
5 лет назад, # |
  Проголосовать: нравится +19 Проголосовать: не нравится

Constructforces :v

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

For question C what is going wrong with this approach? https://codeforces.com/contest/1166/submission/54311053 thanks.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is it just me or was problem A description confusing? I still don't get how three chatty students paired together are considered three chatty pairs, while two students together are considered one chatty pair

how does this generalise for n > 3 ?

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

how to solve E?

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    The answer is possible if and only if there exists no pair of days on which Dora visits two disjoint sets of stores.

    The proof that no other cases work is trivial; the proof that all of these cases do is less so.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится +5 Проголосовать: не нравится

      Proof by construction -> for each set have unique prime and multiply all values visited on that day by the prime. Values start with 1 on day 1. Because each set contains its own prime and all primes of others, LCM in it will be maximum possible. On the other hand, if there is some value between stores that this set did not touch and its value is maximum possible, then it must contain all primes (I mean, number stored in it is divided by all those primes) and so each set contains it, contradiction, we said it was outside some set.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Problem C. Testcase:

4

1 1 2 2

What is the answer?

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +13 Проголосовать: не нравится

    All of the potential values are guaranteed to be distinct, so this is an invalid case.

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      It never said they are distinct. "unordered pairs formed by two different elements", does not specify that, are two numbers distinct if they have the same value or different index? I went for the solution that counts such case just and it got accepted.

      • »
        »
        »
        »
        5 лет назад, # ^ |
          Проголосовать: нравится +1 Проголосовать: не нравится

        The second line contains n pairwise distinct integers...

        • »
          »
          »
          »
          »
          5 лет назад, # ^ |
            Проголосовать: нравится 0 Проголосовать: не нравится

          Thanks, I see. It should be part of problem, not "Input" part then. I think, input is for constraints on sizes, not number properties.

»
5 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

Thanks, Codeforces for another good round! Although, unfortunately, it will take a long time until the next round...

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

IMHO, problems D and E should have been valued equally. I didn't solve E, but I can see in the comments that there is a simple idea behind the solution (and more people solved it than D). On the other hand, D was a rather implementation-intense problem, it took 40 minutes to code the solution :)

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I came up with Idea for E but did not submit it, it looked too easy. Seems I had right solution tho. I'd not say the idea is simple, but implementation really is.

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

for problem D isn't is hold? Any number between lower bound and upper bound form by current state a solution can be find ,i just did binary search by this but failed

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится -13 Проголосовать: не нравится

    My solution to D relied on the fact that through messy casework, we can prove that two numbers x and y with |x| <= |y| form a valid pair if and only if |y| <= 2|x|. I thus created a vector containing the absolute values of all the datapoints, sorted this vector, and then did two pointers.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    just found it was small mistake on bound ,modify it then got AC

»
5 лет назад, # |
  Проголосовать: нравится +2 Проголосовать: не нравится

thx 4 fast testing)

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится +8 Проголосовать: не нравится

I read comments, many users have solved problem D with greedy algorithm. My solution is constructive, works in O(k^2) per query. I missed couple of minutes to submit:(((, but I believe I have a proof for my solution. Has anyone else solved it with a not greedy algorithm?

UPD: It turns out that my solution was wrong :( sometimes it doesn't find any solution), which is a pity as my solution was quite beautiful.

»
5 лет назад, # |
  Проголосовать: нравится -9 Проголосовать: не нравится

What is the point on setting too much math problems? >:(

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +6 Проголосовать: не нравится

    Do you think that implementing boring algorithms is better than nice, math problems with short and clean code?

    • »
      »
      »
      5 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      Yes. Precisely building your answer through hard thinking and combining algorithms is much prettier than just solving an inequation on paper and then passing it to boring code. This is not IMO but ICPC

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Did anyone else solve E by constructing a DAG based on subsets, and checking for existance of topoloical order in that graph?

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    This argument is valid, but I think you will need additional observations for dealing with memory issues (to make sure not too many subsets are being considered) It is enough to ensure that there are no conflicts — i.e, there are no set A and B of given sets, such that $$$A \subset B^c$$$. What you said is equivalent to this, but using some unnecessary subsets.

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    ba iharke Paron Pashinyan

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

My first contest after a loooong time! Hello again Codeforces! ^^

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can someone tell me why I got WA on tc 20 for C 54289806

»
5 лет назад, # |
  Проголосовать: нравится +79 Проголосовать: не нравится

When both you and the problem setter do the math wrong...

»
5 лет назад, # |
  Проголосовать: нравится +12 Проголосовать: не нравится

Did you guys know that a = b.flip() on bitsets changes value of b??? I guess I'm lucky to catch that bug while participating out-of-contest :D

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

Моё решение по задаче А: link
Задача А из данного раунда имеет довольно простую идею, поэтому реализации разных участников могут совпадать или выглядеть, с точки зрения системы, довольно похоже: (link — author — MK_99).
Могу заверить, что свой код я не выкладывал в публичный доступ. (смысл сообщения — сообщение от системы о списывании)

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

I recommend you two pointers method for problem C. In my opinion so easier way than binary searches.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
5 лет назад, # |
  Проголосовать: нравится -16 Проголосовать: не нравится

I cheated this contest and i am sorry for my behaviour, but i am still in the official list of participants and i think that i don't deserve to be in the official standings.

»
5 лет назад, # |
  Проголосовать: нравится +23 Проголосовать: не нравится

It’s a pity that I didn't become winner of div.2 qaq~

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
5 лет назад, # |
Rev. 2   Проголосовать: нравится +25 Проголосовать: не нравится

I suggest from now on everyone who cheats to get last place in the contest as punishment, like i did and got -181.

»
5 лет назад, # |
  Проголосовать: нравится -16 Проголосовать: не нравится

Codeforces must fix at least 1 contest every week. If possible 2-3 would be great!

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится -17 Проголосовать: не нравится

The second test case for D problem is wrong as it is clearly mentioned in the question that ri>=1

juckter

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    how is it wrong? The sequence only has one number so $$$r_i$$$ is not relevant.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Can someone please tell me why my codeis giving runtime error the only thing i did was to replace the first scanf for no. of test cases to cin

  • »
    »
    5 лет назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    You shouldn't mix scanf/printf with cin/cout if you're using ios_base::sync_with_stdio(false); , removing that line would fix it. Also, this blog post is for round #561, not #560.

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Me during the contest:

(for those who don't know, they are pinyin for the Chinese words "yes" and "no" and I speak Chinese as a native language)