Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

Автор Akulyat, 2 года назад, По-русски

Привет, Codeforces!

Три года спустя первые идеи о контесте воплотились в полноценный набор задач, и я рад пригласить вас принять участие в Codeforces Round #824 (Div. 2), который состоится в 02.10.2022 17:35 (Московское время). Раунд будет рейтинговым для участников с рейтингом менее 2100. Участники из первого дивизиона приглашены принять участие в раунде вне конкурса.

Вам будет дано 6 задач и 2 часа 15 минут, чтобы их решить. Все задачи раунда придуманы и подготовлены мной.

Также я хочу поблагодарить

Разбалловка: $$$500-750-1250-1750-2250-3000$$$.

Обратите внимание, что некоторые задачи имеют схожие баллы. Ваше видение разбалловки может отличаться, поэтому не забудьте прочитать дальнейшие задачи, если вы застряли на какой-то.

С нетерпением жду увидеть вас в таблице результатов. Надеюсь, вам понравятся все 6 задач, и желаю всем удачи!

Слишком много пальцев вниз

UPD1: Разбор

UPD2:: Победители и Первые решения

Div2

Place Participant
1 HugeWide
2 9u46
3 naaamte
4 seaneri
5 huweidong

Div1 + Div2

Place Participant
1 maspy
2 orz
3 BurnedChicken
4 disorientation
5 Chenyu_Qiu

Первые решения

Task Participant
A bigfather
B Chenyu_Qiu
C Elaina-chan
D Sai_t
E swiftqwq
F tfg
  • Проголосовать: нравится
  • +227
  • Проголосовать: не нравится

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

\ (•◡•) /

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

I can't wait to get back

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

I reacted with heart on telegram

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

wish everyone will find something interesting in this round

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

I hope to cross 1000 rating mark in this contest for the first time ^_^

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

Mamba Mentality Round

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

I hope to come back as an expert

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

Its time to summon the hearts <3 army. Letss go

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

Finally a contest on the weekend that I can do!

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

Hope For a Big +ve delta to everybody in the contest

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

    That's not actually possible because rating is not calculated like this, let's suppose everybody solved all problems then its not that everybody will have +ve delta, delta is based on the people which have higher rating than you but performed less than you, then you will have a +ve delta...like sort the registered participants by rating and then see on which number you are coming if your rank in the contest is more than that then you will have +ve delta (assuming everybody who has registered participates).

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

A round with no tester comments! That's pretty astonishing. Edit: Now there are some.

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

As a tester, this contest has a couple of nice problems, and the overall quality is much better than average!

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

As a tester, I must say that the problems are really great and I highly recommend everyone to come.

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

This gonna be my first contest ever, I'm so excited

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

Hopefully i dont get destroyed by the problems like the last contest :*).

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

Hoping for +141 delta

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

My first competition

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

Good Luck Everyone!!! Hope everyone has a fun time :)

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

You could find someone to teach you if you don't know how to write a problem description, and about what information shuold be emphasized.

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

Solution for problem D has been leaked on a discord group by a user named Instrospection. Solution is in Python

ATTENTION, please look into it coordinators and MikeMirzayanov

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

The problem statements were shit.

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

I spent too much time understanding the question, which is unfair to foreigners like me. Maybe my English is too poor.

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

I appreciate illustrations to the problem statements to make them more understandable. Without them it might've been crazy

A — 24mins, still don't know what it was about, just submitted the obvious formulae from the samples after giving up on thinking.
B — 16mins,
C — 31mins, I feel like my implementation is crap but the task itself is quite decent.
D — 24mins (just like A). Surprisingly easy. I enjoyed this kind of problem but wonder if it is too straightforward. Guess could've solved it even faster.

So to me C>A>D>B . But from the number of submissions the round seems well balanced in general except E which has a very few submissions but it is fine for most people I guess.

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

    how do you do D? Why is it easy?

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

      I guess as always for me I either think in the right direction or not. And here I was lucky.

      First think about how to find all triplets. Notice that two cards uniquely identify the third one. So you can calculate all the triplets for n*n*k. After that it becomes a basic combinatorics

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

      1) By two cards you can determine third to be in set
      2) So if two cards determine the third, then there cannot be two sets with strictly two common cards
      3) It means that any meta-set is two sets with one common card
      4) This gives O(n^2 * k) solution (store all meta-sets by common card and some combinatorics)

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

    lol idk why so many ppl have such weird opinions on the problem set. Sure, the statements were unclear (especially for B, where it was blatantly incomplete). Regardless, I think the ideas required for the first 3 problems were what you would expect in a Div2

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

      ok then maybe ur better than me then. I find it's super challenging to think (even if the problem is easy) after spending 90% of brain stamina to understand the statements.

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

        I wasn't replying to you. But I can tell you for sure that the English used for A was perfect, not sure about B. It's just that A is a difficult to understand problem in itself, maybe they could have reworded it better to make it sound less mathematically rigorous?

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

The gap between D and E is too big.
And WHY TIMELIMIT OF D is FOUR SECOND???
Even the most brute force $$$\mathcal{O}(n^3k)$$$ can pass??? Why???
(Submission 174397296 and My hack)
Just why 4 sec??? Is there a standard solution that can`t run in 2 sec???

a very bad round for me. not worthy of the time.

wow upvotes are dropping very fast:) expected it to happen:)

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

    Wuf. Even my python solution passed for half a second

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

    If $$$O(n^3k)$$$ can pass then it is the fault of the weak pretests not the loose time limit.

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

    I'm actually very surprised that brute force would pass, even with the generous 4 second time limit, since it's like, $$$10^{10}$$$ operations. My guess is that the pretests are actually not too strong, and we might see TLE hacks and/or FST on $$$O(n^3k)$$$ approaches.

    I think the standard approach would take $$$O(n^2 k \log n)$$$ time (find sum of all pairs, store them in a map; then for each card, count how many instances of its additive inverse is present as a pair sum and add the count choose 2 to the answer). Mine took 623ms, so it should comfortably fit 4 seconds with slower languages or approaches with poorer constant factors (though I don't think mine was anywhere near optimized to begin with). Maybe they wanted to disallow unordered map hacks?

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

    n^3*k passed main tests...

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

I think the problems is really good and I enjoy it, but the descriptions of them is so unclear that I waste lots of time. Hope the next time the words will be much clearer.

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

did u have to do graphs to detect cycle in C?

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

    well, it's just one cycle so you can check indegree and outdegree but I was too lazy so I used a DSU xd

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

      can u show me ur submission by pasting it here or somewhere else with a link? i wanna see but submission are not viewable rn

      • »
        »
        »
        »
        2 года назад, # ^ |
          Проголосовать: нравится -18 Проголосовать: не нравится
        Here you go
      • »
        »
        »
        »
        2 года назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        https://codeforces.net/contest/1735/submission/174413223

        No graph. I used a Map to track which character corresponds to which character (obviously empty in the beginning).

        Filling that map is the crux of the problem. I used a List-array of size 26 to store all connections.

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

      I used DSU with path compression. I was about to implement union by rank, when I recalled that it's only size 26, which is definitely not worth that much effort.

      flakes24 it should be enough to just store a parent array or even a map to indicate which character precedes another. Then when you want to make a new mapping, you can simply check all ancestors to make sure this new successor doesn't form a cycle, unless you already have a chain of all 26 letters, so the only remaining relation is to complete the cycle. I didn't actually do this (I used DSU instead), but I think this should still pass the time limit, provided that the rest of your algorithm is efficient enough.

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

        I thought about doing the second method (cycle method also striked but im not that comfortable with graphs yet), but it felt too implementation heavy to check 26 ancestors. But i had about 110 minutes after doing B and should have given it a try atleast. Thanks for the help tho.

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

      btw, do u know any good resource to learn dsus in this context?

      i dont know why youre getting downvoted tho

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

5/10 for problem quality.

1/10 for problem description.

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

Solved D 30 seconds before the end of the contest b/c I had thought my sol was incorrect.

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

I did not like A at all. I liked B a lot. The hardest about C and D were understanding the problem statements. I am grateful the testcases were good, else I would not have understood anything.

The difficulty felt nice, except for A. I think A was too strange, took me 30min to write 1 correct line of code. Solved A, B, C and D

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

Upvotes on this blog is gonna drop faster than my rating

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

The problems is really good but the descriptions of these problems are not clear.

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

got a stroke reading/trying to understand problem C

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

E is a bit boring, because there are too many details to pay attention to.

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

In problem B, " You want that for each pair of pieces, their sizes differ strictly less than twice. "

Twice of what?

In problem C, " each letter in s was replaced with the one that follows in clockwise order ",

Follows what in clockwise order? should have been "replaced with one that follows it in circle in clockwise order"

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

    Exactly ! Not specified clearly

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

    Nice comment!

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

    Twice of what?

    I think it is pretty clear the size of two items differ strictly less than twice means the bigger of the two is less the two times bigger than the smaller.

    Idk

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

      It definitely was not clear. My initial interpretation was that if you compare every possible pair, you would find strictly less than two instances in which the the result was that the elements were different. Of course, this would imply that all elements must be equal unless there are $$$\leq 2$$$ elements, so I was very confused at how simple this was, until I saw the test cases.

      The visual explanation helped clear up my mistake, but it doesn't change the fact that the initial wording was very poor. Thankfully, a clarification was issued shortly at the start, so they at least responded properly to inquiries.

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

I think C is easy for people who knows graphs (dfs) and can write very hard code

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

All the problems were insanely good, and I especially liked C. One of the most balanced + well prepared round I have ever participated in. Congrats to authors!

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

Problem F is a good problem!

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

I misread the shit problem statements many times. My entry experience was extremely bad.

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

Is there anybody else who struggled in understanding problem statements today?

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

Very confusing description... Had to guess the meaning based on given test cases for the first few problems :-)

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

    Can you specify what exactly was not clear?

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

      Perhaps "very confusing" is a bit over, but I think I do need to carefully look over every word in the description to understand them, while in previous contests just skimming over is enough. For example, "For this reason, all 26 lowercase English letters were arranged in a circle in some order, afterwards, each letter in s was replaced with the one that follows in clockwise order, in that way the string t was obtained." It seems unclear to me what each character in s is replaced with, and I had to go over the TCs to make sure what I am thinking is correct.

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

How to solve D?

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

    Ok, this was the first time I solved D, and to do so I broke this problem into different parts, so the first significant observation was no 2 sets can have 2 same cards, as it will force the third card to be same and hence 2 sets to be same. So let's say card 1 was in 6 sets then I can combine any 2 sets and that will be a meta-set, so the total meta-set would be 6C2 (choose any 2 sets among all possible), so, if I am able to find in how many sets each card is in then I can sum all their results (cnt[i]C2). To find a set, for each pair of cards I found out which was the required card so that they form a set (this card will always be unique) and checked if that card existed in our n cards, to do so in log(n) I stored each card in the map. so total time complexity was O(n*n*k*log(n)).

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

Make it unrated

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

    Why? That's all legal. Statements hard to understand but you can understand

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

    This round must be unrated because we can't understand the problems. So without understanding we can't solve.

    some people are not good in english so you better use simple words/sentences.

    "their sizes differ strictly less than twice." this is shit.

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

How much for a good problem statement, please? ,

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

why engish in this round so hard to understand qnq

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

Is there anyone like me? When I'm confused about a problem statement, my brain is fried and can't think anymore for the rest of the contest.

I was super confused about A and D problem statements.

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

    I spend about 20 minutes in understanding problem A and decided to leave the contest.

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

      I spend around 25 min in finding a approach with wrong submission , It is more logical than B

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

I quickly found a solution for E, but unfortunately, because i was stuck on C for a long time because of implementation issue, i had no time to implement E. Solved A,B,C,D

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

It's all contests this weekend, I had a blast XD.

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

Solution for D:

Firstly,let's find all "sets":

Enumerate each pair $$$(card[i],card[j])$$$,we can calculate a unique $$$card[k]$$$ according to $$$card[i],card[j]$$$.

Next, we only need to check whether $$$card[k]$$$ is in the given cards.

Time complexity:$$$O(n^2k)$$$.

Next, we notice that the intersection of two "sets" has at most one card.

$$$Proof$$$:assume the intersection of two "sets" has 2 cards $$$card[i],card[j]$$$,we can calculate a unique $$$card[k]$$$ according to $$$card[i],card[j]$$$,which leads to contradiction.

For each $$$card[i]$$$,suppose it exists in $$$k[i]$$$ sets,if $$$k[i] \geq 2$$$,we can select two from the $$$k[i]$$$ "sets" to form a "meta-set".

It can also be proved that all selected "meat-sets" are distinct.

So the answer is $$$\Sigma {C^{k[i]}_{2}}$$$.

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

D and E are amazing!
D ... All CPer who have played SET must think "From $$$2$$$ cards I can identify the last card" at least once, I guess.
E ... We must use matching to solve this? Nope.

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

good contest!!!

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

Problem description left the chat.

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

cannot understand the problem

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

i spent more time understanding problem statements than actually solving them.

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

CF rounds helping us practice reading comprehension as well. nice.

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

"their sizes differ strictly less than twice." I bet it'll be fun to solve the "once" version of it. Twice fun in fact.

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

I solved A by test case №3 i just divided 1033/3 and found genius formula.

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

Problem D

English version: "A feature for three cards is called good if it is the same for these cards or pairwise distinct."

machine translation of Russian version: "For a trio of cards, a characteristic is good if it is the same for all three cards, or all three are different in pairs"

Sad that I prefer the machine translation...

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

Can anyone please explain problem C in a clearer way?

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

    in order to get the lexicographically smallest string you should go from left to right and try to map every character by the alphabetical order from a to z,consider it as graph where there is a directed edge from a character to the character it is mapped with, here you should take care of 3 cases

    1 — you can't map a character to itself (loop edge)

    2 — you can't make a cycle of length less than 26

    3 — you can't map a character to an already mapped one

    take a look at my code , i hope i made it clear.

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

      where is your code?

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

      Many many thanks for explaining the solution approach, but I was more into problem statement, what actually the problem said?

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

        simply you initially have a string s , to obtain the string t you make your own alphabetical order of the 26 letters such that each letter in string s is replaced by the letter the goes next to it in the alphabetical order you just made

        for example if your s is aqerk and your 26-string order is something like au..qw..er..rz..ko , then your t-string is uwrzo

        now you have string t , you should output the lexicographically smallest string s which could lead to string t by some mapping order

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

ReadingForces

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

Very intresting!I tried my best and I think I will get a good result.I really love these problems.

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

I really enjoyed today's contest. Although some of the problem descriptions werent the best, problem A B and C were very interesting and the pretests were very strong. keep it up!

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

Problem description is like: Go A to B then go C then back to B, again back to A then go C finally print "Helo World".

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

Had a contests filled weekend and I had a great time

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

The questions were really good! Thanks for good questions :)

  • The solutions and proofs were all very beautiful(for the questions I have solved)
  • The problems were generally straightforward

My only possible critism is that this round was more about finding ideas....

But I really enjoyed it!

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

Anyway, a good contest!

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

Святой рандом, спасибо.

ACC(на дорешке) — https://codeforces.net/contest/1735/submission/174432285

WA50(на контесте) — https://codeforces.net/contest/1735/submission/174424186

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

can someone please help me, where am I going wrong this is solution for B

            Arrays.sort(arr);
            int div = 2*arr[0]-1;

            for (int i=0; i<n; i++) {
                if (arr[i] >= 2*arr[0]) {
                    ans += (int)Math.ceil(1.0*arr[i]/div);
                }
            }
            System.out.println(ans);
  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    I think you need Math.ceil(1.0*arr[i]/div)-1 instead of Math.ceil(1.0*arr[i]/div) as dividing a number in n pieces will need n-1 operations

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

    Note: ans+=(arr[i]+div-1)/div-1; That is math

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

In problem D, I used unordered map to hash from vector of int to int and it took over 1 second to run which is longer than most submissions. Anyone know why?

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

    hash function could be slow, there could be hash collision in your hash function, or else there is somewhere else that adds/multiplies to the time complexity.

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

      Is there any better data structure to store the value for each card? Because editorial also suggests us to use map/hashmap.

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

        I think map/hashmap is good enough for the question, but generally I don't recommend you using unordered_map on codeforces, as it could be vulnerable to hacks by deliberately causing hash collisions.

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

          In the case of problem D, I think it is possible to hash the set without hash collisions using 3**k and long long int; If you used this as an hash value, I think map/hashmap is going to be near to best you can use.

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

            Yeah, I just tried your suggestion and it still took quite long so the problem might be my implementation. Anyway, thanks a lot for detailed explanation.

»
2 года назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится
I would like to thank:
"Aleks5d, arzhantsev64, ChthollyNotaSeniorious, DanWallgun, flowerletter, Gegege337, Imakf, LeoRiether, mejiamejia, okwedook, PO3OBAR_Bblnb, SSerxhs, TomiokapEace, triple__a, wabadabakalakaboo for testing the round and giving significant feedback."

I see that there are several testers. Do they only verify the accuracy of the judge data or do they proofread the problem descriptions as well?

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

Can Any Body explain the Solution of Problem B

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

    174391163 if you see my code.I think you can understand this problem.

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

    It is no good to divide further the smallest number, as it will always result in more operations caused by having to divide up other numbers further. And therefore, we can transform the question to: given n numbers, make every numbers that are not the smallest number between the range of smallest number/2+1 ~ smallest number*2-1. Dividing each number so that all numbers are between the range will take ceil(number/(smallest number*2-1))-1 operations: and so the answer is the sum of it for all numbers.

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

      dhyang24 why you have taken ceil(number/((smallest number*2)-1))-1 rather than ceil(number/(smallest number*2))-1 this

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

        The question states that the biggest number should be strictly smaller than smallest number*2; the maximum number after the division must be (smallest number*2-1)

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

      It is guaranteed that if you divide a number in ceil(number/(smallest number*-1))-1 parts, when evenly distribued, it is in the range of smallest number/2+1 ~ smallest number*2 -1

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

        And can you tell why have take -1 after calculating ceil value

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

          dividing a number into n parts will take (n-1) operations, as each operation increases the total number of parts by 1, and the initial number of parts is 1.

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

The quality of problems in this contest is much better than average.

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

I’m sorry that the English statements are confusing.
I tried to make them plane, but it was hard for some sentences.
We discussed the places you were confused by and these are the best formulation we eventually came to.
I would really like to see your suggestions for replacing them. I still can’t choose good options. I hope that next time I’ll be more careful and precise.

I hope you enjoyed the problem ideas after you got through the statements.
Anyway, don’t forget to check the editorial and feel free to ask me if there is something unclear there too.

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

Problems have pretty bad wording, otherwise it is fine I think

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

C, it correct when I tested but codef say... 174424830

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

    I don't understand your approach entirely (it would help if you commented what the different arrays actually meant), but it seems like you're missing the check for when all 26 letters are linked, in which case you would need to link the endpoints to form a cycle.

    Instead, I think your approach would eventually try to extend beyond the 26 letters and/or try to access an array element that was not initialized, which can lead to different results. As such, even if you saw the correct answer on your own machine, there may be undefined behavior, which can lead to different results in other machines.

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

I need upvote anyone can help TT.

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

Ratings updated preliminarily. We will remove cheaters and update the ratings again soon!

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

speedforces

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

    not really, at least problems up to C were definitely not the hardest problems (in the corresponding position) I've ever seen. I even thought D might have been worth a try. (though I did lack the ideas for it)

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

Problem F is very nice, thank you!

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

Thanks for the round! Problems was interesting!

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

In question C: why can't

badcfehgjilknmporqtsvuxwzy be the answer for abcdefghijklmnopqrstuvwxyz?

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

There is Codeforces Official Channel in Telegram with round announcements. For some reason, all posts get an overwhelming amount of thumbs down. Can we turn the situation around and let hearts win? 209 hearts and 139 thumbs down at first message, 134 hearts and 137 thumbs down at second, hearts are winning

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

it's hard to understand some problems

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

I like this Score Distribution : 500 — 750 — 1250 so much

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

Had lot of learning and fun. Thank you

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

I think the problem D should add a tag named Reading Comprehension.

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

I don't quite understand why there are many difficult problems to read recently, such as the D problem, which is difficult to understand, but it can be quickly understood after understanding

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

I don't quite understand why there are many difficult questions to read recently, such as the D question, which is difficult to understand, but I can quickly pass after understanding

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

D and E are very nice problems! (especially D in my opinion)

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

can't find my rating; I can still see the score and rank, but not rating, I remember seeing a notification saying that my rating has updated post this contest. Was the contest made unrated or is this something that only I am facing?

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

My and someone else's solution to problem A was reported to be very similar. Now this is because we happened to use the same template, which is available online, and the code was pretty short, the logic was pretty straightforward and hence this happened. Why would I even plagiarize question A. Please revert back my rating changes, this is a mere coincidence.

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

My solution to A was reported similar to someone else. Now, this is because we happened to use the same code template, which is available online, and the code for A was pretty short and simple. This is a mere coincidence. Why would I plagiarize problem A. Please revert back my rating changes, I have given the contest honestly

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

My solution to A was reported similar to someone else. Now, this is because we happened to use the same code template, which is available online, and the code for A was pretty short and simple. This is a mere coincidence. Why would I plagiarize problem A. Please revert back my rating changes, I have given the contest honestly