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

Автор Igor_Parfenov, история, 3 года назад, перевод, По-русски

Привет!

В 27.04.2023 17:35 (Московское время) состоится Codeforces Round 868 (Div. 2).

Задачи написал и подготовил Igor_Parfenov.

Я хотел бы поблагодарить всех, кто сделал этот раунд возможным:

Этот раунд будет рейтинговым для участников с рейтингом менее 2100.

У вас будет 2 часа для решения 6 задач.

Разбалловка: 500 — 1000 — 1250 — 2000 — 2000 — 2500.

Удачи!

UPD: Разбор

UPD: Поздравления победителям!

Div.2:

  1. Low-Deny-Cup

  2. psz6

  3. BULBULBUL

  4. Epyset

  5. chenguoyi

Div.1 + Div.2:

  1. SSRS_

  2. maspy

  3. Rubikun

  4. heno239

  5. Crystally

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

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

As a tester, Igor_Parfenov did his best to make sure the round is balanced and interesting. Hope you enjoy.

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

As a tester, I shall farm contribution.

PS: Hope you like the round and wish you positive rating :D

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

As a tester, I would recommend that you don't name yourself purp4ever, thinking that you'll be a Dominater069 of the candidates and then become an expert because your friends FetFot and MaherSefo will say awoo and make fun of ywooo. Then you would eat Shawerma out of sadness.

I know this is madlogic

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

Thank you

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

Probably the shortest codeforces round announcement blog i have seen in a while

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

Edit: My bad I apparently can't calculate dates correctly.

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

I am unrated as I joined codeforces few days ago . I am thinking of participating in this contest . So Will I get rated after competing in this contest , or there are some conditions like you have to participate in 4-5 contests to get rated ? Please do answer .. It might be helpful for other new participants as well .

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

Hope the problem statements would be as small as the blog :)

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

I couldn't come up with as a tester comment, that's why I don't have the right to write as a tester at the beginning of my comment.

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

As a Green tester,

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

good luck

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

As a gray participant, i'm not sure

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

A very streamlined competition announcement

»
3 года назад, скрыть # |
 
Проголосовать: нравится -45 Проголосовать: не нравится

"I would like to thank everyone who made this round possible"

"who" should be "that"

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

i wish to be pupil after this contest

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

now there are a problem in the server, all submissions stack in the queue, please fix it we do not want unrated contest

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

score distribution?

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

How far is purple?

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

There are so many submission still in queue, I'm really worried about getting stuck in the contest tonight.

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

Good Luck for all participants

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

The difference between C and D is massive.

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

I will be a pupil in this night! Good Luck for everyone.

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

madlogic wrote As a tester, Igor_Parfenov did his best to make sure the round is balanced and interesting. Is this contest really balanced after this score distibution?

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

Hope no queueforces

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

I wish to become an expert after this contest, please say good luck to me, thanks.

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

Желаю всем участникам раунда, которым осталось чуть-чуть до нового звания, достичь его в этом раунде. Кстати, меня это тоже касается, так как мне немного осталось до ученика. Хоть я уже и был учеником, вернуть его всё равно хочется :)

Всем остальным тоже желаю успехов!

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

Do I get some penalty for Unsuccessful hacking attempt?

Do I get some reward for Successful hacking attempt?

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

Is it me or anyone else also feels that this contest was a bit tough?

A was a bit tough than usual?

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

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

I will probably miss the chance of becoming CM because blind me couldn't see 1e7 * 1e7 * .... * 1e7(1000 times) isn't 1e10

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

Thank you for 5 math tasks and constructive D

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

For me, A was tougher than B and C.

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

Fantastic problem E. (Hint Sprague-Grandy function)

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

Submission to E Can somebody check where I got wrong? Wrong answer on test case 9

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

I kept getting TLE on C, probably some stupid mistake, can someone give a brief solution of C?

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

Please explain D

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

    one thing to know that, n length string can produce max n palindrome.Now suppose u need 3 palindrome on a segment, then can simply print aaa.. you have to just maintain no different segment disturb others.. so take 1st 3 char abc and when you don't need more palindrome on that segment use abc cyclicly nullify extra one.

    suppose on a segment, need 4 palindrome in 10 length string then u can print:
    abc c abcab [3rd part for nullify]

    And when x[i]<c[i] No [x[i] len string can make max x[i] palindrome]
    also (x[i]-x[i-1])<(c[i]-c[i-1]) No [for same reason]

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

      adding to this, use new character for every query. There are max 20 queries, so we can use all 26 letters of alphabet. To create new palindromes, use new character, to not create new ones, use the used ones. This can be done in O(n) time.

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

I was solving quadratic equation for A without seeing n <= 100 !!!

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

Can anyone explain the logic behind C

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

    We want the product of ai ... an to be equal to bi ... bn, Therefore their total prime factorisation should be the same (the prime factorisation of the product from ai to an). So we can keep track of the total prime factorisation (and the counts of each prime factor) of ai to an.

    We also realise that p^2 where p is prime, is a strongly composite number. This is because the factorisation will then be [1, p, p^2] which is valid. Therefore it would be best to form p^2, p^2, p^2 for every prime factor in your total prime factorisation.

    Now we have leftover primes, we realise again that prime * prime * prime will give you a strongly composite number. This is because the factorisation will be [1, p, q, r, pq, pr, qr, pqr], which is valid. Therefore we can group the leftover primes by groups of 3

    The answer will then be:

    1. ans += each prime factor count // 2
    2. leftovers += each prime factor count % 2
    3. Then after step 1 and 2, ans += leftovers // 3

    If anyone has any alternative solutions please feel free to share! I'd like to learn as well :)

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

    The product of all the integers in the given array is same as the product of all possible prime factors, so the condition for product is already satisfied if you break each integer into prime factor. Now to find the integers of array B(i.e strongly composite numbers) you can see that if any prime factor raised to the power 2 will always be a strongly composite number, so the necessary condition is finding prime factors that have power >= 2, now since you only require minimum (2 prime integers to make them strongly composite) you can utilize the remaining ones to help make the prime integers that aren't strongly composite i.e they exist individually. To make a strongly composite number out of different prime factors you require atleast 3 of them(like 3, 5, 7 can together form a strongly composite number). So all that if left to do is to count the prime factors % 2 and then use them later on in pairs of 3 to form a strongly composite number. Here's my way of doing it: https://codeforces.me/contest/1823/submission/203710826

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

Great contest, just incase someone is still struggling with Problem A, Problem B or Problem C, You can view the self made video editorial here — video solution

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

Struggle is real. I was standing at 2450 rank and after resubmitting the same code i got a rank of 3800 just wow.

codeforces rul..

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

If a contestant submits several times a problem's solution that passes all pretests, then the last solution is considered as the contestant's verified solution for this problem. All other solutions will be considered as unsuccessful attempts.

i found out after i submitted another solution in the last minute just to try!

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

welp, RIP those of us who got cute/lazy with C and FST/TLE :P

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

Feels like the third rated contest in a row i got D within minutes of the contest ending (cus of some if i forgot), feeling cursed

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

A: Let there are i occurences of 1 and n-i occurences of -1, then k=i*(i-1)/2+(n-i)*(n-i-1)/2. Since n is small we can find i by brute force.

B: Let's classify indexes by i%k, then we can swap any 2 elements with adjacent indexes in the same class, so we can rearrange elements in the same class arbitrarily. Therefore, if for all i p[i]%k=i%k holds, we can sort the permutaion directly; if for at most 2 indexes p[i]%k!=i%k, we can use the preliminary exchange for them and sort the permutation.

C: We can see that "weakly composite" numbers are product of 2 different primes.

Proof

To solve the problem, first we need to find prime factorization of prod(a[i]) by prime sieve, assume prod(a[i])=prod(p[j]^r[j]), then we check for the array r[j]. If we need to get a strongly composite number, we need a square factor or 3 different prime factors. Therefore, if max(r[j])==1 and size(r)<=2, there's no solution. Otherwise, the answer is sum(floor(r[j]/2))+floor(sum(r[j]%2)/3), first part for numbers with square factor and second part for numbers with 3 different factors.

D: First, we have p(s, m+1)<=p(s, m)+1.

Proof

Therefore, if c[1]>x[1] or c[i]-c[i-1]>x[i]-x[i-1] there's no solution. Otherwise, we can construct a solution: First let s[1, 3]="abc", then p(s, 3)=3. Then we denote d[1]=c[1]-3, d[i]=c[i]-c[i-1] is the number of extra palindromes we need to create at position x[i]. Then for each i, we let s[j]=(char)('c'+i) for j in range [x[i]-d[i]+1, x[i]]. So we fill the first range by "ddddd...", second range by "eeeee..." and so on. Each range will create new palindrome equal to its size. By the condition that c[1]<=x[1], c[i]-c[i-1]<=x[i]-x[i-1] and 3<=c[1]<=c[2]<=...<=c[k] these ranges don't overlap, and by the constraint k<=20 we have 'c'+i<='z'. Finally, for all indexes i that s[i] is undetermined, we fill them by 'a', 'b', 'c' alternately, since there are no palindrome other than "a", "b", "c" in "abcabcabcabc...", they will not create any new palindrome.

E: We solve the problem by Sprague-Grundy theorem. Let's denote sg[i] as the SG number of situation of a single cycle with size i, then if i < l or i >= r+l, we have sg[i]=0, otherwise sg[i]=floor(i/l). I have idea to prove it but it's too complicated.

F: Let's forget everything of probability, and construct a path with following properties:

-Start at s, end at t.

-For each node i, the number of occurences of (i-->j) in this path is the same for every adjacent node j. We denote this number as dp[i].

Then we can get the answer by this path. Let t be the root of the tree and j be the parent of i, then the transition is dp[t]=0, dp[i]=dp[j]+1 if node i is on the simple path from s to t, dp[i]=dp[j] otherwise. That's because if i on the simple path from s to t, the number of occurences of (i-->j) will be one more than occurences of (j-->i). Finally, we have ans[i]=sum(dp[j]) if i!=s, ans[s]=sum(dp[j])+1, where sum is over all adjacent node j of i.

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

Problem D and E should not have same score.

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

Problem C is the most beautiful problem i ever seen

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

The implementation of the special judge of Problem D seems much more difficult than the solution.

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

    Yeah, my guess is they planned on asking if a certain string satisfied those conditions, but made the problem easier by only asking for a construction.

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

    Yeah when I was doing D I wondered how they are going to test it. How can we do better than O(n2)?

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

      Fastest way is probably Palindromic Tree. But it can be done with hashing in O(nlogn), by abusing fact that there can be at most 'n' unique palindromic substrings of any string of size 'n'.

      Core idea of this approach, is to consider the longest palindromes centered upon each index. For each such palindrome, insert its hash into a set and trim its outermost characters; repeat the process for each trimmed palindrome until it coincides with some palindrome in the set. The size of the set will be the answer.

      I guess it can technically be reduced to O(n) if you use unordered_set and Manacher's algorithm.

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

[deleted]

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

I don't know why my performance is declining day by day :(

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

Problem E is identical to this problem

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

    They're actually not the same. In problem E you can (after two removals) break a connected component into two separate components. You cannot do this in G. Constrained Nim 2. But it happens to be that the solutions are almost the same.

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

Подскажите, почему рейтинг не поменялся после контеста? Или нужно чуть дольше подождать?

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

MLE on C :/

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

Hey, I solved C fair and square. I had almost one hour left, and I also refreshed in between to see for changes. How can they change the constraints after the contest, not at all fair. If I got tle before I would have corrected it with one penalty, but now my rank dropped from 2k something to 4k. I am not at all happy with this behavior.

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

I have a question, why isn't this submission giving me runtime error? (On line 43). https://codeforces.me/contest/1823/submission/203713818 Would have solved it during contest if it did.

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

a great contest but if the problem D were easier the contest would be more interesting and balanced

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

Are there any special prerequisites needed to solve today's E?

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

D was a very fun problem for me (even though i found A-C a bit boring), thanks!

gonna get to e tmr but i have an ap test monday XD and i must study

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

Right now it doesn't allow to make any submissions, it shows "Unexpected error". What happened?

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

Hello,

my submission 203696670 of the problem C (Strongly Composite) has been flagged as a rule violation because of it's similarities to the solutions of Aku30, stark_tony_, ek3ru8m4 and dmenezes with ids 203691212, 203691644, 203694434 and 203695366.

This is because all five of us decided to speed up factorization with a list of all prime numbers from 2 to about 3137. This list is obviously the same for each of us, as we all included the numbers in ascending order. I probaly don't need to mention this, but a list of these prime numbers has been published before the contest.

I would therefore like to appeal my disqualification, along with the disqualification of Aku30, stark_tony_, ek3ru8m4 and dmenezes, as I feel it was unjustified.

Thank you for your consideration.

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

    The only thing common among all of our codes is the list of prime numbers rest is completely different, and you can also notice the range of prime numbers taken into consideration varies with person. Therefore, along with the other participants mentioned above I would like to appeal my disqualification.

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

Hello, my submission of Problem C 203692110 significantly coincides with the submission of arbalestOvO / [submission:203688479]。In our submissions, we coincidentally use the pallard-rho algorithm to decompose prime factors, and this code implementation has been made public by others before the competition. Here is the link to the code: (https://judge.yosupo.jp/submission/82101). I would therefore like to appeal my disqualification. Thank you for your consideration.

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

Broo.can anyone please say why i am getting tle for palindrome question-D. i am not able to find the fault.(https://codeforces.me/contest/1823/submission/208179126)