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

Автор Flamire, история, 11 месяцев назад, По-английски

Hello, Codeforces! We're glad to invite you to take part in Codeforces Round 1064 (Div. 1) and Codeforces Round 1064 (Div. 2), which will start on Nov/16/2025 17:35 (Moscow time). You will be given 6 problems and 2 hours to solve them in both divisions.

The problems were authored and prepared by le0n and me.

We would like to thank:

Score distribution:

  • Div. 1: $$$500-1000-1500-2500-3000-4000$$$
  • Div. 2: $$$500-750-1000-1500-2000-3000$$$

We hope you'll enjoy the problems!

UPD: Congratulations to top $$$5$$$ in Div. 1 and Div. 2.

Div. 1:

  1. maroonrk, achieving perfect score at an astonishing 01:18:30!
  2. JDScript0117, with an outstanding comeback at 01:55:46!
  3. Benq
  4. ksun48
  5. Nachia

Div. 2:

  1. __lucailie, with a final solve at 01:59:15!
  2. weertyu
  3. su_da
  4. Axiom_
  5. WangYuanyi

First solves:

Div. 1:

A: ksun48
B: Benq
C: OrangeEye
D: Benq
E: Benq
F: maroonrk

Div. 2:

A: f___off
B: Animesh--__--
C: lemmec0de
D: Doraemon-_-
E: Shakhzod_Toshpulatov
F: kyUUKoU

UPD: Editorial is out!

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

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

not counting this one, 5 of the last 6 div-1 rounds have had an LGM as one of the setters (and there wasn't a single LGM setter in rounds 1013-1047 before these)

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

Tested 3 months ago and almost forgot everything, can I participate?

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

Tested, I

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

Didn't test 3 months ago and almost remember nothing, can I not participate?

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

Help me reach -99 in contribution

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

oh I tested

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

Hoping for an easy B than C this time.

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

As a tester, why can't I remember testing it?

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

hope everyone gets positive delta <3

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

Wow, I just saw an announcement (it poped in the middle of the website, as usual round announcements). If I'm not mistaken, if somebody missed it, it's only possible to see it after the round starts. Is that correct and if so, is that intended?

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

    In case anybody is interested, this announcement is as follows.


    General announcement

    Hacking is disabled in problem A-D (in div. 2). In problems A-D, system tests are equal to pretests; in problems E-F, system tests are equal to pretests plus hacks.

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

I think DIV2C is same as DIV1A based on Score distribution

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

My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064. My rating is 1064.

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

hi

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

Best of luck everyone!!! Hope you increase your rating :) !!!!

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

Vote up if you think the problems are nice.

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

can someone check div2 B, simulate the test case 1 iteration number: 6,7,9. upon simulation answer comes out as 6,5,6 yet in the answer of the testcase it shows differently.

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

I have mastered the art of speedforces

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

$$$C$$$ is such a shit problem. 4k solve difference between $$$C$$$ and $$$D$$$ in Div2. Speedforces Shit round.

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

div2B is a strange problem for me, it cost me 20min to solve it :(

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

In my opinion, D2C / D1A was way to easy to guess

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

speed forces ... so many quick solves till div2C but then div2D has less solves

I like the visualization for div2B

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

I don't think 1B/2D is that easy.

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

For D I had an idea, but it was already too late to implement it :(

Get an array with the amount of occurrences of the numbers and sort it decreasingly. a1 >= a2 >= ... >= ak What I got is that for each i, we can get the following amount of multisets that exclude elements which would come from a_j, j < i:

a_i * (Choices(a_{i+1},...,a_k) — (#choices with < a1 — ai elements))

Then, the sum would be the answer. For the testcases it seemed to work, at least.

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

I don't know about others, but for me personally, problem E was obvious, I came up with it after reading it, and I spent some time on problem D, but I couldn't pass it during the round (although I came up with a rough solution).

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

idk if only I felt it but problem B was way too tricky..

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

D2E uses very similar idea to 2147E - Maximum OR Popcount

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

Problems are great but why not 3h duration? I don't think 2h is enough for this round.

Personal complaint: I can pass 1C if I have 3~5 more minutes...

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

    3 hour contests are usually div1/div2 contests with 8 problems, not contests with 6 problems, and at least in my case, the extra hour would probably just end up with me staring at 1D with no ideas whatsoever for one more hour.

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

Is D1D a Kuhn-like algorithm?

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

I tried my best on D but couldn't come up with an approach, can someone hint it please.

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

Div 1 D reminded me of this recent problem + solution. Took me some time to make sure this is similar enough to apply a similar algorithm.

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

To me, d2E is quite easy but d2d is a little bit harder:(

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

    Can you provide a hint for D2E? Please put it under a spoiler tag.

    My observation was:

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

      Intuition: We need to look at the highest bit and use a number to satisfy this highest bit. We use the biggest number to achieve this somehow.

      Let query be $$$q$$$. Iterate those biggest elements $$$e$$$ starting from the biggest:

      • If $$$e \lt q$$$ and they have different highest bits, then add to $$$e$$$ until $$$e$$$ and $$$q$$$ have the same highest bit. Subtract $$$e$$$ from $$$q$$$ and continue.
      • If $$$e \lt q$$$ and they have the same highest bit, then subtract the highest bit from both $$$e$$$ and $$$q$$$ and then put $$$e$$$ back into your set of biggest elements. Then continue.
      • If $$$e \gt =q$$$, then finish.

      See 349330720.

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

        Thanks! I had a very similar solution, except instead of putting e ^ (1 << firstbit) back into the queue for reconsideration in case 2, I was trying to find the largest submask of $$$q$$$ that is $$$\le e$$$. 349323998

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

    Can't agree more

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

approach for C , hint ?

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

    I just simulated the process by eliminating the smallest remaining element, and merging it into its smallest neighbor. Note that since the element getting eliminated in the current round is the smallest, its neighbors will be greater than or equal to it.

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

      how to do index as if one value is deleted it stays in vector : 4,1,1,1,5 -> 4,1,5 but in vector its 4,-1,-1,1,5

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

        Maintain two arrays of length n:

        1. $$$prev[i] = $$$ index of the element that comes before the element at $$$i$$$-th index
        2. $$$next[i] = $$$ index of the element that comes after the element at $$$i$$$-th index

        You can reason about why $$$prev$$$ should be initialized with $$$[n-1, 0, 1, \dots, n-2]$$$, and $$$next$$$ with $$$[1, 2, \dots, n-1, 0]$$$. When processing the element at index $$$i$$$, we can eliminate it by doing 2 reassignments: $$$next[prev[i]] := next[i]$$$ and $$$prev[next[i]] := prev[i]$$$.

        You can see my implementation.

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

    solve the problem for a linear array first, then your answer will be the linear solution ignoring the largest interval (cost is largest element) of the circular array.

    There is a 1 for-loop solution for this problem dsu isn't needed

    hint for linear solution: consider the minimum contribution any element can have to an optimal solution

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

A, B, C resembles a Div. 3 problem

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

2D(1B) was an awesome difficult problem. It took me so long to reduce the problem into a knapsack variant tho.

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

How does D1C/2E make it to the contest?

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

How to solve problem D? Couldn't clearly understand the problem, like what does modes mean?

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

I wonder how many AC 1C would have if the same idea didn't appear in a recent round (https://codeforces.me/contest/2147/problem/E )...

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

Estimated time for the rating to roll out?(I'm quite excited)

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

amazing round! I spent around 45 minutes on B (lmao), then i solved greedly C using dsu, and I came up with an idea for E literally 2 minutes after the end

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

There is a possible wrong test case in Problem B — Tab CLosing.

In test cases 6, 7 and 9 the output given is 1, 2 and 2

Whereas the output according to the visulaizer given in the problem is 6, 5 and 6 respectively.

The output of my solution is also 6, 5 and 6 for these test cases respectively.

349309302

Problem link — https://codeforces.me/contest/2166/problem/B

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

Love the efforts you all make to create such high level questions :)

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

cant authors see ritesh_3822 submissions time... bro submitted till E in 39 mins with codes like huge submitted in 2mins.. do authors even see submissions of top people or people who are writing in their blog..

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

did authors cant see who are they putting in their blogs like many of div2 first solvers or div2 5 top participants are cheaters .. they can see their submissions.

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

Is it only me or 1C is much easier than 1B?

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

I want a rollback… maybe it will turn my 1996 into 1200 points

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

I solved div2(C) using a decreasing Monotonic Stack. First time I've gotten to implement this in a live contest!!!

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

guys i am in love with div2 C(div1 A problem)(cyclic mereging) i also made a video on that go check it out (not here for views(i mean i do but) literally i loved that problem so i wanted to make https://youtu.be/hcCuCJHx_OY ;).

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

User ajmahim2020

During today’s contest Codeforces Round 1064 (Div. 2), the system skipped your submission for 2166A - Same Difference.

Screenshot-2025-11-17-004643

"It seems that you didn't understand the logic of the problem. In your first submission, your answer was skipped. After 3 minutes, you sorted the string and submitted it again, which wasn’t necessary. If you had written your first submission by yourself, you wouldn’t have done the sorting."

Screenshot-2025-11-17-004709

Screenshot-2025-11-17-004729

The reason i am writing because you did the same in Codeforces Round 1061 (Div. 2) in 2156A - Pizza Time.

Screenshot-2025-11-17-012527

You are copying code from somewhere or something like that in contest. you breaking contest rule and destroying the fairness.

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

Wow Speedforces and I got +42 delta

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

A hint for 2F/1D?

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

I believe that user weertyu is an AI cheating user. The variable names in his code are very similar to those of AI. They are composed of both lowercase and uppercase letters, and the variable names are long and complex.

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

    He weertyu has different I/O methods for each problems solved in the contest.

    Problem A — Uses builtin normal scanner with no custom made template.

    Problem C — Uses buffered reader and print writer but no helper methods of template, parsing the values each time taking input

    Problem D — creates custom class FastReader as in template to read input but uses builtin System.out.println() to print the output.

    Problem E — uses custom FastReader input but uses PrintWriter for output.

    In a single contest, using 4 different I/O methods is suspicious.

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

i love codeforces

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

I love codeforces

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

Is Problem C genuinely difficult, or does it only seem hard to me?

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

Kinda late to the party but I would like to add my two cents on div2(c) solution. My idea is if we look at the maximum element in this array than the element to the right of it has no choice but to make the pair with its right one. Because if it were to choose left one the anser would always be non optimal as the left one is the biggest. Now if we have the array as:

a1, a2, a3, a4, a5....an

and let a1 be the largest than a2 makes pair with a3. Now the smallest of both is replaced. Our answer will always contain max(a2, a3) because at some point a2 has to pair with the one at its right. If a3 < a2 than cost a2 will happen. Even if a3>a2 than cost a3 has to happen as only someone bigger can remove a3. I think this part is a bit fuzzy so I would appreciate if someone can complete my proof of why this actually works.

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

Can someone tell how can one comeup with the solution to problem c div2 from scratch like what things should one try after looking at such a problem.any general problem solving principles that turn out to be handy (please dont tell go practice,i know that is important but there is more to it than just practice)

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

    After looking at problem I realized that to get the minimum sum, I would have to make sure to merge the largest element at the end. I thought that it would require graphs or linkedlist where I have to recursively solve the question but if you just add all elements before the largest element in reverse order and then all the elements after the largest element in reverse order, you would get a list of elements in an anti clockwise cyclic order. Then just compare every 2 elements and add the maximum of the two to the sum and at the end add the max element.

    for the example:

    7

    1 1 4 5 1 4 1

    we exclude 5 and then have a list which is [4,1,1,1,4,1], sum=4+1+1+4+4=14 and add the max element and we get sum=19

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

Solution when?

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

Everyone is saying that C was very easy , but I am still not able to understand the main idea behind the solution . The n.log(n) solution specified in the editorial is using linked list which we usually avoid in cp and also I am not too comfortable with data structures as I am still new in CP. I saw another solution where we store max of all possible adjacent values and then sum the smallest n-1 of those which does give the answer. But the prove behind that is still unclear and also how will one intutively think about it.

Also I have been practicing CP from usaco guide and cses , are these resources sufficient to excel in CP and particularly on CF.

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

where is the tutorial ?

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

The editorial for Problem Div2D/Div1B is unclear. Can anyone explain, plz?

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

In the Second question of Div2, add this testcase a = 10, b = 25, n = 2 and check how many would have got wrong submissions.

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

I was cheated by divccc,he sat nearby and copy my code when I go to the toilet,NOW my score has been DNF

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

[deleted,idk who stole my account]

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

for problem C

If two adjacent x and y are equal can we choose where we merge x and y? for example 1 2 2 2 1 -> 1 2 2 2 or -> 2 2 2 1

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

For Div2C, does anyone know why working in reverse does not work? For example, greedily building the input array from the maximum element.

https://codeforces.me/contest/2166/submission/361319091