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

Автор awoo, история, 10 месяцев назад, По-русски

Neapolis University Pafos

Привет, Codeforces!

Серия образовательных раундов продолжается благодаря поддержке программы Computer Science and Artificial Intelligence (CSAI) в Neapolis University Pafos со стипендиями от компании JetBrains.

В 29.12.2025 17:35 (Московское время) состоится Educational Codeforces Round 186 (Rated for Div. 2).

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6-7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Иван BledDest Андросов, Максим Neon Мещеряков и Роман Roms Глазов. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Спасибо тестерам раунда FelixArg и KIRIJIJI за ценные советы и предложения!

Желаем удачи в раунде и успешных решений!

И по случаю Нового года — с наступающим! Желаем вам гениальных идей и множества AC в наступающем году.

UPD: Разбор опубликован

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

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

first

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

The real Good bye 2025

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

so many cheaters in last round, it's last contest of the year, I hope we don't see another round where 10000 people solve problem C.

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

there is no way he just did the 67 joke...

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

For Problem 148A A. Insomnia cure, should I study the inclusion, exclusion version that was in O(1) time. Like is it common to see things like that, so I should study it? Do discrete mathematics concepts like that appear sometimes? My solution was really brute force compared to that one.

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

Will score distribution be released soon?

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

Why 6-7

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

Why 6-7

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

Awoo supremacy...first educational good bye to 2025

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

Hope you didn't say 6-7 problems just for the meme

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

What does it take to AK this round ?

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

I thought the Goodbye Contest was meant to be the final one of the year ;-)

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

i really hope to reach new max :(

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

Where unrated register?

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

Wish you all have great ending of 2025 with this Educational round.

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

hope for all a year full of new ranks

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

hope for all a year full of new Ranks

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

As a femboy, I am NOT looking forwards to dropping to Pupil this round!

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

Hope to solve at least 4 problems, thus increase my rating.

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

i hope i don't get clicked this time ^_^

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

Hope i can solve ABC

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

haha wtf lol 4k solves on $$$D$$$ and 2k on $$$E$$$?

too easy or all cheaters?

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

D >>>>>> E

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

C should have been better.

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

how 4k people solved d ?? is it that easy ?

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

D >>> E. Shitty speedforces :( Please make a better contest for the end of the year.

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

lowkey have to quit cp ig not improving little bit

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

why so many solves on C and D? Cheatforces!!

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

C was so bad!

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

How so many solves on C and D? Cheatforces!!

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

Thank you for D and E. amazing problems.

I felt E < D in difficulty.

Also, GAP between C and D was little more than expected, but it was worth it. ( I can't believe so many people solved D !!! ).

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

Great contest! (Though I got a million WAs for no reason on A nd D XD)

All the problems I solved (A-E) where interesting and more or less the right difficulty, and the other problems seem nice, too. I especially loved D!

Only one small problem: E was much easier than D, though I don't think that it affected the contest quality or my performance, so it wasn't a big issue for me

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

2k rank for 4 solved XO

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

People seems to got faster in a few months or I am just getting worse

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

D felt way harder (combinatorics) than E (simple greedy strategy)

»
10 месяцев назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится
  • couldn't solve E, tried some greedy thing but failed :( , like give boxes to people who might need more coins and then give coins from small requirement to large ..

  • please give hints for E

  • also C was a bit tricky for educational round ... even though it was not so hard but still so many solver surprise me !!!
»
10 месяцев назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Big clutch for me ig, I forgot that the contest existed until 20 min into the contest

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

How to solve C ?

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

    I used DP ... length of longest valid subarray from ab[i][j] ... meaning u start at index i in a and index j in b

    once you have this .. then it is not so difficult .. but I still feel this was tricky

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

    For i = 0, you can calculate all valid j(ignoring k for now) in O(n^2). The number of valid j can be called val_j.

    Note that if i = 1, each valid j is also incremented by one. Therefore, the total number of valid (i,j) pairs is n*val_j since i can be any value and there will always be the same number of valid j.

    Next, we can repeat this logic with j and k. For a given j, the number of valid k is val_k and can be calculated in O(n^2).

    The number of total valid j is the number of valid (i,j) pairs which were calculated above, so the answer is n*val_j*val_k.

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

    if you want a valid pair for i,j,k

    u can break it as number of valid pairs for i,j and number of valid pairs for j,k

    since its a transitive relation

    to compute number of valid (i,j) pairs

    you pick an offset value from 0 to n-1

    and need to check if for all i = 0..n-1 , the j = i + offset, satisfies the condition a[i] < b[j]

    if it satisfies then this offset contributes to a valid pair,

    similarly find for (j,k)

    now the answer is the product of these 2, but these are just in the form of i, j = i + d1, k = j + d2

    but i can start from 0 to n-1

    so answer is n * (number of ways to get pair (i,j)) * (number of ways to get pair (j,k))

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

    I solved it in a stupidly simple way. I don't know if it's correct. for string $$$a$$$ and $$$b$$$, I rotated $$$b$$$ by $$$0,1,...n-1$$$ positions and counted the number of positions by which if $$$b$$$ is rotated, $$$a_i \lt b_i$$$ for all $$$i$$$ (let's call this $$$numCompliantRotations(a,b)$$$.

    the answer is $$$n*numCompliantRotations(a,b)*numCompliantRotations(b,c)$$$ because the three rotations are independent.

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

4K rank for 4 solved.....;(

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

Why is $$$n \le 50$$$ for D when a solution in $$$\mathcal{O} (n \log MOD)$$$ exist?

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

D absolutely kicked my ass. Can I have a pointer on it? I was thinking it was something DP related which is a big weakness of mine.

I was thinking of sorting the private boxes, then somehow making dp[k] being the ways to pick k people fairly?

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

    Why makes a permutation unsuitable? Given that there is a valid permutation(answer > 0), what differentiates permutations?

    Once you figure this out, the rest becomes intuitive.

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

      A permutation is unsuitable when there isn't enough in the public box to cover the 'debt' difference between the private boxes and their maximum; to put it loosely. Permutations are differentiated by their orders.

      So say we make the maximum private box our K'th box, then our permutation count is the possible permutations of our 0th to K-1'th box, multiplied by our K+1'th box to N'th box.

      Add these permutations up, and we get our answer.

      I think I get it now, thank you so much for your help.

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

    I did it this way: first balance box 0, then to make it fair, either all elements must be x or x followed by x-1. Since you can only add to balance, x at least has to be the largest element in the boxes, so we can divide it into two zones, the quantity x and x-1, find the quantity in different ways with permutation and multiply them.

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

Was F1 like a binary digit dp?

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

missed F1 by 5 minutes, feels bad man.
Image
the only diff between wa and ac

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

From where to read the solution editorial there is no stream for it's solutions i solved A was stuck in B was very close to solving it couldn't no gpt rule so where can i read the solution ?

»
10 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +36 Проголосовать: не нравится

Miseed F1 by 5 minutes, feels bad man.
 Image
The only Diff between wa and ac

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

Great round!

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

How 9k successfull submissions for C ?

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

    It was quite a simple problem, your answer is |a|*f(b, a)*f(c,a); where f(x, y) is the number of cyclic shifts of x such that y_i < x_i.

    You can get to this by realising that you can only produce all n snowmen if a_i < b_i for all i, and likewise for b and c, given a specific cyclic shift.

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

WA on D because I think when n = 1 the answer can be 0...... ;(

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

Hope we will all get good ratings before 2026 ! :)

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

Hope we will all get good ratings before 2026 ! :)

»
10 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +39 Проголосовать: не нравится

4000 AC on problem D? CP nowadays is becoming a nightmare for legit contestants

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

huge cheating done on problem d and e

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

I couldn’t understand how come such a huge number of participants came up with a bitmask solution for Problem A, most of which got hacked. But when I copy-pasted the problem into ChatGPT, it became clear.

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

I couldn’t understand how come such a huge number of participants came up with a bitmask solution for Problem A, most of which got hacked. But when I copy-pasted the problem into ChatGPT, it became clear.

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

Huge cheating on d and e

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

May someone explain why is n not greater than 50 in D?

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

    awoo constraints ;)

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

    cause there isn't obvious non-deliberate worse time complexity solution, maybe.

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

      0_0

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

      I actually solved it in O(N^3) using dp. I thought it would tle but apparently it is fast enough.

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

        Can you please explain your DP solution.

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

          I would recommend waiting for the editorial because I think my solution will turn out to be completely unnecessary/missing something, But here you go:

          I started by looking at the condition that makes the permutation fair.

          First, let $$$S = \sum a_i$$$ (summation of all $$$a_i$$$ from $$$0$$$ to $$$N$$$).

          Each player will play for $$$\lfloor S/n \rfloor$$$ rounds. Except for the first $$$S \pmod n$$$ players, who will play an extra round.

          Each player will try to use only his box until he finishes it, and only then will he use box $$$0$$$. So he will consume $$$\lfloor S/n \rfloor$$$ gifts in total, $$$a_i$$$ of them from his own and the rest from box 0.

          Additionally, He will consume an extra decoration if he lies in the first $$$S \pmod n$$$ positions, he also greedily consumes it from his box if possible otherwise box 0.

          If the sum of those consumptions is $$$\le a_0$$$, then the permutation is fair. Otherwise, it is not, because if it exceeds $$$a_0$$$, then box 0 will run out too quickly and one of the players won't be able to play.

          Now the problem becomes: who will I assign in the first $$$S \pmod n$$$ positions, and who will I assign in the following $$$n - (S \pmod n)$$$ positions?

          This is what I use DP for. My state is $$$dp(pos, sub, amnt)$$$: * $$$pos$$$: current player being considered. * $$$sub$$$: how many players from the first $$$S \pmod n$$$ use a decoration from box 0. * $$$amnt$$$: the amount of players that I need to select to be in the first $$$S \pmod n$$$ spots.

          The transition is just: either put them in the first $$$S \pmod n$$$ group or put them in the other spot. For the base case, I just multiply by $$$fac[S \% n] \cdot fac[n - (S \% n)]$$$ to account for all possible orderings of this grouping.

          Keep in mind most people had simpler solutions, I haven't upsolved yet but they probably exploited something I haven't noticed so that they don't need DP.

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

        I could have implemented my solution in O ( N ) I believe .

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

Looks like if I want to reach expert then I need to consistently do D :(

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

how can i get the editorial?

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

does anyone know if we can solve problem F1 with the help of segment trees, and if yes, then how?

i tried to do it but couldnt, the type 3 query was making it problematic for me. i would really appreciate if someone could tell if there is a way to solve using segment trees.

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

    seg tree?!? may i suggest using static array instead sir.

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

    I also tried and failed, but I think my general idea was close.

    Think of it like digit dp with dp[pos][tight][started]. DP is not necessary, but the ideas are useful. Considering started as an implementation detail, and pos as each bit, you can iterate downwards through the bits. Let's also define t as the number of bits greater than our pos which are in the x. Let us also assume tight is always true.

    If the previous bit present in x is p, we can do some casework. If we select the next number to be at a bit in (pos+t, p] then the number will be greater no matter what the next bits are. For each number we can choose, we add w * 2^z to the final answer where z is the number of integers in [0,p] excluding our current number. w is the number of ways to reach this position(will be defined later).

    If select the next number to be at a bit [0,pos+t), the number is smaller resulting in no solution.

    Finally, the next number is equal to pos+t, the number is not guaranteed to be big enough but also not guaranteed to be too small. I defined w as the number of ways to reach this position. The transition is just w *= segtree[i]. This does not add anything to final answer, it just increases the number of ways for the case where the next bit is greater.

    The final case(which I ran out of time for), is applying w at the end of a number. The value of w after going through all digits expresses the number of ways to hit exactly x. Based on p, you can consider every subset of future numbers(2^z where z = size of ([0,p]-1)), and then add it to the final answer.

    I didn't get the problem, so I'm not sure, but this was my idea.

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

How to calculate the CP can be very confusing sometimes, but I don't think that really makes it harder to solve D than E, since the method is already there. Sadly, I didn't manage to solve E since I'd wasted to much time figuring out D =(

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

For some reason, I found D (4000+ AC DAMN) to be much harder than E, Was able to solve D in last minutes, and post contest, just took 3-4 minutes to come up solution for E.

I basically fixed the maximum element first. Every other element (those < Max) must use box 0 at least Max − a[i] − 1 times to “catch up”, assuming they all sit to the right of the Max element. After subtracting these mandatory uses from a[0], if R becomes negative the answer is 0.

With the remaining R extra uses of box 0, I choose how many of those right-side elements can be moved to the left of the Max block. Let F be the count of elements equal to Max. Then for i = 0…R, I place (F + i) elements on the left, compute the number of ways using factorials + nCr, and sum them up

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

how to solve c ?

what i had in mind, is to to fix array a and try all allowed rotated array's for b and c

but i couldn't get how i,j and k's can be counted.

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

we should learn from these coders , rank 17,20,18,19 they solved all 8 questions in their first contest , they should be awarded by codeforces @MikeMirzayanov

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

A quick (scientific) note to the authors pertaining to F1/F2:

The carrying capacity of a population (a group of a species) is the amount of organisms that can be sustained in the environment. It was pretty clear towards the end you were referring to carrying gifts, but just a FYI.

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

Good Bye 2025

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

I want to report cheater wegokic234 with using LLM

Here https://codeforces.me/contest/2182/submission/355745999

And you can see this code has if (!(cin >> ... ))

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

By when the ratings are supposed to change ?

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

Unfortunaly , It was last contest of the year...

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

A great goodbye for 2025!

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

What's the expected rating of Problem C ?

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

Hello contestant, My name is not showing in standing table — what's the reason behind this, Is anyone tell me?

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

Hello Contestant, My name is not showing on standing table — What's the reason behind this, please anyone can tell me?

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

    one needs to be a trusted participant (means one must have participated in atleas 5 contests and solved 1 question in them ig) but you can go to your profile, friend yourself, and then see your standing in friends standings

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

have the rating updated ?

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

Another way to solve C

numValidTriplets = numAllTriplets - numInvalidTriplets

numAllTriplets = n^3

We can compute numInvalidTriplets as follows:

numInvalidPairsAB = No. of pairs in A and B which violate condition (Pairs with same drift count to one pair)

numInvalidPairsBC = No. of pairs in B and C which violate condition (Pairs with same drift count to one pair)

However, these are just pairs across two arrays and we will need to exclude duplicate triplets while deriving invalid triplets from these invalid pairs This can be computed as n*numInvalidPairsAB*numInvalidPairsBC

numInvalidTriplets = n*n*numInvalidPairsAB + n*n*numInvalidPairsBC — n*numInvalidPairsAB*numInvalidPairsBC

Hence solution will be: n^3 — (n*n*numInvalidPairsAB + n*n*numInvalidPairsBC — n*numInvalidPairsAB*numInvalidPairsBC)

https://codeforces.me/contest/2182/submission/355838323

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

Is this contest unranked?

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

67

»
10 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +26 Проголосовать: не нравится

So let me get this straight, this guy https://codeforces.me/profile/Ananya_CodeNova has a Youtube channel https://www.youtube.com/@CodeNovaYT where he is live streaming contests and displaying solutions directly and pasting them into YT comment section, Telegram group and google drive.

Not only he is not banned, his submissions are not even skipped.

Additionally, there are at least 10-15 contestants in the top100 of this round that have basically identical code and not even they are banned.

This is an absolute joke.

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

you could scale up constraints in D. N <= 10^6 is still fine! why 50?

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

when will ratings be updated?

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

Where rating?

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

Why did i not get any rating from this contest even after solving three problems? Is anybody else facing this problem and does anybody know what to do?

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

Tutorial for D:

Prerequisites: Factorials, combinations $$$n\choose r$$$, stars and bars, inverse factorial modulo $$$p$$$ using Fermat's little theorem

There are two important observations to make.

First, we can assume that every person takes from their own box first until it runs out before taking from the common box. If this were not the case, then someone had the choice of either taking from their own box or the common box, but chose to take from the common box instead. We can only be worse off in this situation, since that person could have potentially taken away a gift that someone else needed whose own box was empty, so we have less chance for the permutation to be 'fair' in the end.

Second (this is the crucial observation to make), the number of 'rounds' that the simulation lasts (that we care about) is $$$\max_{i=1}^n a_i$$$. To think about it easier, assume that the common box had an infinite supply of gifts (or simply some large enough number to ensure that anyone can take from it when their own box is empty). Once the last person (or last few people with $$$a_i=a_{max}$$$) finishes taking gifts from their own box, then everyone would have an empty private box, and whatever is left in box 0 can simply be taken until it runs out.

If at any point in time before the last round, someone is unable to take from both their private box and the common box (both $$$a_i$$$ and $$$a_0$$$ are 0), then there are no fair permutations at all and we can return $$$0$$$. Since it does not matter what permutation the boxes are in if there is at least one person who always runs out of gifts to take before the last round regardless of the permutation. To be clear, one 'round' is when we loop through the persons from $$$1$$$ to $$$n$$$, and each person takes from their own box if it is not empty, or otherwise takes from the common box. In every round before the last, we only care about the value change in each person's $$$a_i$$$ as well as the change in $$$a_0$$$, not the order in which they change, since they all result in the same change regardless of permutation (non-empty $$$a_i$$$ decreases by 1 and $$$a_0$$$ decreases by number of $$$a_i=0$$$ which are forced to take from the common box).

Let's assume there is enough in $$$a_0$$$ to support everyone until the last round (otherwise we can simply return 0). We can split into two cases, one of which is easy. Let's assume there are $$$m$$$ people with one more gift in their private box, and $$$n-m$$$ people who have nothing in their private box and are forced to take from the common box. Then if $$$a_0\geq n-m$$$, there is enough in the common box to support all those with empty private boxes. This means that regardless of whichever permutation we chose, there will always be enough in the common box to support everyone through all rounds, so the answer is $$$n!$$$.

Otherwise, $$$a_0 \lt n-m$$$. In this case, only $$$a_0$$$ of the $$$n-m$$$ people can take from the common box. The other $$$k=(n-m)-a_0$$$ are forced to be the last $$$k$$$ in the permutation. They cannot come before any of the $$$a_0$$$ people who are taking from the common box, nor any of the $$$m$$$ people with one more gift left in their private box. This is so that the process ends before they have to take a gift from $$$a_0$$$ (now empty), so the permutation remains fair.

So we have to choose $$$a_0$$$ out of $$$n-m$$$ people, permute the people who take from the common box, and permute the people who are forced to be the last $$$k$$$. There are $$${{n-m}\choose a_0}\cdot a_0!\cdot k!$$$ ways to do this.

For the $$$m$$$ people who have one more gift in their private box, they can be placed anywhere in the first $$$n-k$$$ positions. An easy way to think about it is, count the number of ways to insert $$$m$$$ people into $$$a_0+1$$$ bins (the $$$a_0$$$ people are 'bars' or separating dividers and we can insert the $$$m$$$ people anywhere beside them), then permute the $$$m$$$ people. An even easier way to think about it is: we have $$$a_0 + m$$$ people in the first $$$n-k$$$ positions; choose $$$m$$$ of those positions i.e. $$${a_0+m}\choose m$$$.

So the final answer is $$${{n-m}\choose a_0}\cdot a_0!\cdot k!\cdot {{a_0+m}\choose m}\cdot m! \mod 998244353$$$. You can simply precompute the factorials and inverse factorials and use them in the $$$nCr$$$ formula.

Submission: 355849613

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

When the rating score will come?

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

It says the round will be "rated for participants with rating below 2100". I'm a newbie with rating 382 (just started cp), I solved 2 questions, but in my profile it shows this contest as unrated, and no rating change has happened..can someone pls explain.

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

Hello everyone. Have a nice day. Where is our ratings??

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

well i had fun

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

good bye 2025 , finally I reached pupil

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

I have a question how to get the right and useful solution with the explanation for a problem that I couldn't solve

THANKS :)

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

C,D can greedy

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

hey everyone, just started doing codeforces, want fews tips to reach pupil. let me know how many questions in div 2 contest i need to do to reach pupil. Any tips to reach fast?

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

hey everyone, just started doing codeforces again, anyone have any idea how many ques i need to do in div 2 to reach pupil and any tips to reach fast?

»
10 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится -8 Проголосовать: не нравится

Today, I received a message regarding my solution for problem 2182E (New Year's Gifts) in this round, which has resulted in a plagiarism flag and a significant rating penalty, resetting my score to 420. I want to clarify that my solution was developed independently using standard competitive programming techniques. The structure of my code specifically the use of a suffix-based greedy scan combined with a priority queue is a well-documented algorithmic pattern. This logic is almost identical to the optimal approach for CF 1140C (Beauty of Playlist), a problem I have studied extensively to understand how to manage resource constraints efficiently.

**https://github.com/sourabhkanojia/CodeForces/blob/master/1140C%20-%20Playlist.java**

The variable names I used, such as pq, cnt, grp, and cap, are universal abbreviations taught in standard tutorials and found in public educational repositories like Prakash-sa/Competitive-Programming. My implementation follows the standard "Greedy with Heap" logic used to solve resource-limited selection problems, where one iterates through a sorted constraint and maintains a pool of candidates in a heap. I believe the similarity to other submissions is a result of this being the most direct and efficient way to implement the greedy strategy required for this problem. I have always worked to improve my skills honestly.

I deeply respect Codeforces and the rules that keep this community fair, but I must express how incredibly frustrating it is to receive this notification. I worked very hard to arrive at this solution and to reach my rating, and seeing it drop so drastically due to the use of a standard algorithm is disheartening. I request a review of my submission based on these standard practices and my original submission time to restore my account's standing.

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

I received a notification that my submission for Problem E was flagged for plagiarism. I would like to clarify that I wrote the solution myself.

I have a complete local development timeline in VS Code, including autosave history and timestamps showing the incremental development of the code from scratch. I did not copy the solution from any external source or other participant.

Could you please let me know what kind of additional evidence would be acceptable for verification? I am willing to share editor history, intermediate drafts, or any other information that may help clarify this.

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

Can someone help me with C and D. Please, how did you got idea and how to improve implentation.

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

Reporting a cheater, used LLM to write the code.... the submission : https://codeforces.me/contest/2182/submission/355725936 reason, --> No consistency of coding languages that are used... --> there's the various inconsistency in coding style of this person...