teraqqq's blog

By teraqqq, 16 months ago, translation, In English

Hello to all fans of competitive programming and Codeforces enjoyers! We're happy to invite you to participate in Hello 2025, which will take place on Jan/04/2025 17:35 (Moscow time).

We, teraqqq, dope, and induk_v_tsiane, have prepared 8 problems for you, and you’ll have 2 hours and 30 minutes to solve them. One of the problems is divided into 2 subtasks. The round will be rated for all participants.

Huge thanks to MikeMirzayanov, geranazavr555, and KAN for great systems Polygon and Codeforces!

Special thanks also go to:

Score distribution: 500 — 1000 — 1500 — 2250 — (1000+2000) — 3500 — 3750 — 4500

UPD (Update!) (Update! Yey!) Editorial — link

This round was prepared with the support of T-Generation. If you are a Russian-speaking student, please switch to the Russian version of this blog. There you will find information about our educational projects that may be interesting for you.

UPDATE

Congratulations to the winners:

  1. jiangly

  2. ksun48

  3. ugly2333

  4. Flamire

  5. Ormlis

  6. hos.lyric

  7. ecnerwala

  8. noimi

  9. maspy

  10. arvindf232

Announcement of Hello 2025
  • Vote: I like it
  • +432
  • Vote: I do not like it

| Write comment?
»
16 months ago, hide # |
 
Vote: I like it +51 Vote: I do not like it

dope you are such a skibidi sigma rizzler

»
16 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

I_love_I_love_kirill22

»
16 months ago, hide # |
Rev. 3  
Vote: I like it +4 Vote: I do not like it

i_love_dope

»
16 months ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

as a participant, I will participate.

»
16 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Hello 2025

»
16 months ago, hide # |
 
Vote: I like it +35 Vote: I do not like it

speedforces?

»
16 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Simplest E1 ever?

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it +19 Vote: I do not like it

    1000 E1 seems a bit fishy. I think solving in order A->B->C->E1 can still be better than A->B->E1->C.

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it +70 Vote: I do not like it

    wth is your pfp

  • »
    »
    16 months ago, hide # ^ |
    Rev. 5  
    Vote: I like it -15 Vote: I do not like it

    I think score distribution is not about rating actually...

    -- a lgm

    • »
      »
      »
      16 months ago, hide # ^ |
       
      Vote: I like it +3 Vote: I do not like it

      you mean a specialist

    • »
      »
      »
      16 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      It's not about rating, but it does tell you the relative difficulty of problems in the contest. In this one, we can see that both B and E1 are worth 1000 points, so they should have about the same difficulty (although E1 will probably be a bit harder, because the easy version of a problem with multiple subtasks usually gives a bit less points than it would if it wasn't a subtask). Usually, E1 is way harder than B, so this is rather atypical.

»
16 months ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

I WILL RETZRN SPECIALIST

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hope to get 1800 :)

»
16 months ago, hide # |
 
Vote: I like it +38 Vote: I do not like it

E1 only 1000 points???

E1 = B < C ???

I'm surprised.

»
16 months ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

I also love Kirill ;)

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

teraqqq is the language of communication and lecture in the camp Russian or English?

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it +12 Vote: I do not like it

    Russian, that's why we wrote information about the camp only in the Russian version of the blog.

    • »
      »
      »
      16 months ago, hide # ^ |
       
      Vote: I like it +6 Vote: I do not like it

      А кружок доступен для уже не школьников? Is camp available for no longer school students?

»
16 months ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Hope chenlinxuan0226 can say hello to Expert rating after "Hello 2025".

»
16 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

Very much excited to participate in the first contest of this year!!

»
16 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

dope has a small eggplant

»
16 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

This is the first contest of the year. Happy new year everyone!!

»
16 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

E1 is just 1000 Damn

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Will there be problems for div4 programmers?

»
16 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

will it be suitable for me (my first time to participate in a contest)?

»
16 months ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

let's destroy this contest

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

quick question, what division is it going to be in?

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

does this mean that the authors predict that $$$E2$$$ will be easier than $$$D$$$?

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

D will be more difficult to me than Ds in other div1+2s

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hopefully the problems are as good as Good Bye 2024! A little concerned that the writers were decided so late...

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I hope I could Solve at least two questions ......

»
16 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

hope i get to expert on this round for a lucky year!

»
16 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

hopefully i don't mess this one up!

»
16 months ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

How can you conceive splitting the E in this economy?

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

new year, new hope. Hoping positive delta

»
16 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

What a thrilling and exciting game (forced smile)

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

(answer $$$q$$$ queries)forces

»
16 months ago, hide # |
Rev. 2  
Vote: I like it +2 Vote: I do not like it

i am gonna start skipping contest that has anything to do with bit manipulation in c or b. It turns to a game of pattern guessing though brute force.

»
16 months ago, hide # |
 
Vote: I like it -25 Vote: I do not like it

i have petition to permanently ban bitset problem from rated contest

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I'm super confused about the number of points for E1. I thought maybe I should try solving it instead of D, but came up with no solution even after I solved D.

»
16 months ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

what is the hack for problem B? is it attacking unordered_map solutions?

»
16 months ago, hide # |
Rev. 11  
Vote: I like it +14 Vote: I do not like it

A: When the MEX value of a set be positive, this set must contain $$$0$$$. WLOG assume $$$n \lt =m$$$ and $$$a_{1,1}=0$$$, then the answer will be MEX of first row plus MEX of first column. If we let $$$a_{1,j}=j-1$$$, the MEX of first row will be $$$m$$$ and MEX of first column will be $$$1$$$, the answer is $$$m+1$$$. On the other hand, value $$$1$$$ cannot be contained in both first row and first column, so the minimum value of MEX of first row and first column is $$$1$$$, therefore the answer is not greater than $$$\max(n, m)+1 = m+1$$$.

B: Let $$$T$$$ be the number of different values in array $$$a$$$, in each operation we can only reduce $$$T$$$ by at most $$$1$$$ (because all values we remove from $$$a$$$ are equal), and if we choose $$$l=1, r=n$$$ everytime, $$$T$$$ will definitely be reduced by $$$1$$$. So when $$$k=0$$$ the answer is the number of different values in array $$$a$$$. When $$$k \gt 0$$$ we need to reduce $$$T$$$ as more as possible, so we need to find value $$$a_i$$$ with minimum number of occurence annd change their value, until we used up all $$$k$$$ operations.

C: First assume $$$a, b, c \in {0,1}$$$. We can see $$$(a⊕b)+(b⊕c)+(a⊕c)$$$ is 2 when $$$a, b ,c$$$ are not the same, and $$$0$$$ otherwise. To find the answer we look at bits of $$$l, r$$$, start from the most significant: Let $$$j$$$ be the most significant bit where $$$l,r$$$ differ, so for $$$j+1$$$-th bit and higher $$$(a⊕b)+(b⊕c)+(a⊕c)$$$ can only be zero. Let $$$B$$$ be the $$$j+1$$$-th bit and higher part of $$$l$$$ and $$$r$$$, and $$$p=1\lt\lt j$$$, we have $$$l \lt (B|p) \lt = r$$$, and because $$$r-l \gt =2$$$, either $$$B|(p-2)$$$ or $$$B|(p+1)$$$ should be in interval $$$[l, r]$$$. By calculation we can see when $$$a=B|(p-2), b=B|(p-1), c=B|p$$$ or $$$a=B|(p-1), b=B|p, c=B|(p+1)$$$, the value of $$$(a⊕b)+(b⊕c)+(a⊕c)$$$ will be the maximum possible (which is $$$1\lt\lt(j+2)-2$$$).

D: We solve the problem by segment tree: For each node representing range $$$[u, v]$$$ we store these values:

  • $$$max_{-}plus = \mathop{\max}\limits_{u \lt =i \lt =v}a_i+i$$$
  • $$$max_{-}minus = \mathop{\max}\limits_{u \lt =i \lt =v}a_i-i$$$
  • $$$min_{-}plus = \mathop{\min}\limits_{u \lt =i \lt =v}a_i+i$$$
  • $$$min_{-}minus = \mathop{\min}\limits_{u \lt =i \lt =v}a_i-i$$$
  • $$$ans$$$ = the answer we need for range $$$[u, v]$$$

When we need to merge 2 ranges $$$L$$$ and $$$R$$$, we first assume we pick max and min value of $$$a_i$$$ both in range $$$L$$$. In this case we don't need to extend the range outside of $$$L$$$, because we cannot get any better answer, so this case answer is $$$L.ans$$$. Similarly when we pick max and min value from $$$R$$$, the best answer is $$$R.ans$$$. If we pick max value from $$$L$$$ and min value from $$$R$$$, we need to find $$$\mathop{\max}\limits_{i \in L, j \in R}a_i-a_j-(j-i)$$$, which is equivalent to $$$\mathop{\max}\limits_{i \in L}(a_i+i) - \mathop{\min}\limits_{j \in R}(a_j+j)$$$, so the best answer for this case is $$$L.max_{-}plus - R.min_{-}plus$$$. Similarly, for the last case, the best answer is $$$-L.min_{-}minus + R.max_{-}minus$$$.

E2: For a certain query $$$(a, b, k)$$$, let's find how to check whether $$$w_k \gt = t$$$ for certain $$$t$$$. Let's assume all edges in the graph with $$$w \gt =t$$$ has cost $$$1$$$, and other has cost $$$0$$$. If we can go along any path, move from node $$$a$$$ to $$$b$$$ with cost $$$\lt k$$$, then $$$w_k$$$ will be less than $$$t$$$ in this path. Otherwise, for every paths from $$$a$$$ to $$$b$$$ we need to pass at least $$$t$$$ edges with $$$w \gt =t$$$, so we have $$$w_k \gt =t$$$ for every paths. Therefore to solve this problem, we can sort all edges by $$$w$$$ from lowest to highest, change their cost from $$$1$$$ to $$$0$$$ one by one, and for any query $$$(a, b, k)$$$, if cost from $$$a$$$ to $$$b$$$ dropped down to $$$k-1$$$ or less, we know the answer for this query is $$$w$$$. So the rest we need to do is keep updating value of $$$cost(a, b)$$$ when cost of edges changed. The initial cost can calculated by Floyd's algorithm in $$$O(n^3)$$$, and $$$cost(a,b)$$$ can decrease at most $$$n-1$$$ times, because if nodes $$$a, b$$$ is connected with edges of weight $$$0$$$, adding an edge with cost $$$0$$$ on $$$(a, b)$$$ will not cause any change of cost on this graph. Each time such decreasement occurs we can recalculate $$$cost(u, v)$$$ for all pairs in $$$O(n^2)$$$. So the problem can be solved in $$$O(n^3+ m\log(m) +q\log(q))$$$.

G: If you've planted sugar cane in Minecraft, the answer is easy to come up with: First, we find all positions $$$(i, j)$$$ where $$$-1 \lt =i \lt =n$$$, $$$-1 \lt =j \lt =m$$$ and $$$(i+3j) mod 5 = 0$$$, and try to add these positions into $$$S$$$: If position $$$(i,j) \in A$$$, we add it into $$$S$$$ directly, any otherwise for each adjacent position $$$(i', j')$$$, we add it into $$$S$$$ if $$$(i', j') \in A$$$. Therefore we've built a set $$$S$$$ satisfies the second condition. To match the first condition, we repeat this process for $$$r \in [0,4]$$$ and $$$(i+3j) mod 5 = r$$$, and pick the set with minimum size, this set will satisfy the size condition. (Prove by AC)

»
16 months ago, hide # |
 
Vote: I like it +51 Vote: I do not like it

i hate problems like C

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

A: I don't know why this works

B: I don't know why this doesn't work (later edit: forgot to pop from priority_queue :(, somehow first pretest passes with this bug X( )

»
16 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

RIP one and a half hour for D LOL. Come back CM anyways.

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hi

»
16 months ago, hide # |
Rev. 3  
Vote: I like it +61 Vote: I do not like it

B: I am sure we were presented a totally different problem... I cannot understand why this happens with this many testers (and why so many contestants "solved" it without trouble), please write a correct statement. The Codeforces rule is also bad and this issue affects too much to the performance.

G (and in general): Why ML 256MB?

H: Chip-firing is well-known. Anyway I needed some observation, so perhaps it is okay.

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it +10 Vote: I do not like it

    B. Sorry :(

    G. There is no special reason. 256MiB is just a default Memory Limit in Polygon

    H. Wow! I honestly didn't know about that. But still, for me, the solution to Problem H looks like an ordinary adhok, and as if no deep theory helps much.

    • »
      »
      »
      16 months ago, hide # ^ |
       
      Vote: I like it +43 Vote: I do not like it

      I'd say default ML in Polygon is bad... (Please take this as a message to coordinators and future authors! The problem G itself was nice!)

      H: Actually I'm not sure if deep theory helps, I just meant this is a known topic so there are similar problems about chip-firing on path, like GCJ 2020 Round 3 C or <Cf problem which I don't remember well>, so I guess some people knew the high-level idea.

»
16 months ago, hide # |
 
Vote: I like it +21 Vote: I do not like it

G is much easier than C. Even 5-year-olds have solved it while building sugar cane farms in minecraft.

»
16 months ago, hide # |
 
Vote: I like it +13 Vote: I do not like it

i thought C's solution was really cool, im surprised people hate it so much

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Can you please explain my thought was at every ith bit 2 nos should have the same bit and third one should have the different bit. So this I was thinking of geting l , l+1 , l+2 r r-1 and r-2 and all possible final values and get hte max out of it.

    • »
      »
      »
      16 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      since we want at most 2 out of 3 people sharing an ith bit, we can guarantee this by having person A be 2^n, and person B be (person A — 1)

      for example person A = 16, then person B = 15

      16: 10000

      15: 01111

      this leaves person C to take anything as long as it fits the constraints because no ith bit can ever exceed appearing twice. this allows the answer to be 16, 15, 14; and if L == 15 then the answer is 16, 15, 17 instead

      • »
        »
        »
        »
        16 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        u can't always chose a power of 2, depends on the interval

        • »
          »
          »
          »
          »
          16 months ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          yeah my bad, i should have clarified the largest power of two where the most significant bit differs. so for l=139 and r=141 the msb that mismatches is the third bit (2^2)

          • »
            »
            »
            »
            »
            »
            16 months ago, hide # ^ |
             
            Vote: I like it 0 Vote: I do not like it

            i'm not sure if that works, u have to check if u can put to one of them full 0's after some bit, u could get a number smaller than the left limit of the interval.

»
16 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

AB are nice problems.

I don't like bit manipulation constructives so C was kinda hard for me. And also it looks to be above average div2C in terms of complexity.

D is an interesting problem. I would love to have more time to think on D as I even didn't manage to get an idea. Too bad C took all my time.

Ehh well. I guess I need to solve some more bit constructives.

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    My performance was about 1400-1600 in the old contest but recently I always get negative delta do you have any suggestions about solving div2C

    • »
      »
      »
      16 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      C usually requires good level of observation

    • »
      »
      »
      16 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      I struggle with Ds so I just upsolve Ds from past div2 rounds if they're in my skill range, so I check the problem rating at clist dot by. If I have no ideas for an hour or something I study editorial hints, then if I'm still stuck I check the model solution but without implementation. Then if it's not enough I study jiangly submission for that problem, as my organization name suggests. His submissions are very clean and usually there is a lot to learn from them, so I often check them out even if I managed to solve a problem on my own. I offer the same strat for div2C.

      Also, what old contests with 1400-1600 perf are you talking about? I see only one Edu round with perf in that range.

      Moreover, performance usually has some variance so it's normal if you get negative delta sometimes.

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I failed to implement D with segment tree in time.... I just spent too much time doing it the wrong way.

»
16 months ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

I got 7 CE in F with C++20 and C++23. Didn't manage to fix it during the contest. WTF is that? :) Works on my computer just fine. After the contest, I decided to switch to C++17 in the custom invocation tab and it compiles normally. Is everything ok with the compiler?

  • »
    »
    16 months ago, hide # ^ |
    Rev. 5  
    Vote: I like it +4 Vote: I do not like it

    This bug presents in gcc $$$[13, 14.2.0]$$$ which just happens to correspond to C++20 and C++23 on codeforces. Your code also yields compile errors on godbolt

    Error message

    It compiles locally because you probably had gcc 12 or gcc 14.2.1. Here are the workarounds that you can use:

    Workaround 1: Remove #pragma target
    Workaround 2: #include <bits/allocator.h> before using #pragma target

    Also sse4.2 is older and not as good as avx2

»
16 months ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it

can someone hack my solution for C? I just brute force things for a while and actually correctly guessed it. Sub: 299665561

I don't have any proof, my approach is finding the best fit for l ^ r, the third one is anything (I tried through brute force for this observation).

Let's say bl = bit of l, br = bit of r (At bit i). If bl == br:

  • if bl == 0 means we need to set bit l[i]
  • else (bl == 1) we need to del bit r[i]

The purpose is finding max l ^ r so the goal is 0 ^ 1 == 1 for every bit possible.

»
16 months ago, hide # |
 
Vote: I like it -58 Vote: I do not like it

What a contest man, Please never make such type of contest!!

»
16 months ago, hide # |
 
Vote: I like it -19 Vote: I do not like it

Russians are setting mathforces and the chinese are now creating good rounds. How the tables have turned.

»
16 months ago, hide # |
 
Vote: I like it +36 Vote: I do not like it

E1 and E2 are free standard problems, but unfortunately, I am intellectually disabled.

»
16 months ago, hide # |
 
Vote: I like it +33 Vote: I do not like it

I especially love problems C and G in some ways. However, people solving ABCDE1E2 have varying performance score from 2000 to 2800, which, looks very scary. I'd say my overall feedback after participating Hello 2025 is: Goodbye 2025.

»
16 months ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

Problem D is anti python users , 2 Seconds is not fair

»
16 months ago, hide # |
Rev. 2  
Vote: I like it +82 Vote: I do not like it

Here is some feedback on the problems:

  • A: Nice problem!
  • B: Bad problem and wrong statement. I agree with hos.lyric that having wrong statements should be more carefully avoided.
  • C: Nice problem! It's rare that I have to think for a problem C. This one required me to stop and think and therefore I liked it!
  • D: The problem is a bit standard. But it is clean and I appreciate it. I had not written a segment tree in years, so the implementation felt harder that it should have.
  • E: After reading the statement, I could immediately solve E1 and I had no idea of how to solve E2. In the end I passed pretests also in E2 with an algorithm that I think should get TLE. I kinda liked thinking about it, but I have one doubt. LOL. Writing this comment I realized how to solve E2 (I guess it's a DSU). I spent more than one hour thinking about it and now, while typing this comment and trying to describe my "doubt" I solved it.
  • F: Skipped
  • G: The statement is amazing. I thought about it for some 15 minutes. No idea of how to solve it. It seems like a great problem.

Overall I enjoyed participating. I would have had a bit more fun if the statements were a bit more carefully written, but that's fine. Thank you to all those involved in the organization.

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

For D, I understood that we have to build a Segment Tree for a + i and a — i, but how to find the answer after every query?

»
16 months ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

If there are some well-known techniques in C

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it +3 Vote: I do not like it

    Unless you consider "going bit by bit" to be a "well-known technique" you don't know (I think that's what you were implying by the italics), then no, there aren't.

»
16 months ago, hide # |
 
Vote: I like it +14 Vote: I do not like it

The tasks were ok overall. E should not appear on codeforces, and D is on the edge of being fine. On the other hand, C was nice, and G too (exactly the type of task I will not solve).

E1 absolutely should not appear on CF (and I don't know what it was doing in the original round either), E2 is arguably fine but I dont like it either. Fairly standard, almost ABC-like (infact i remember a similiar trick in a ABC contest)

The preparation seemed somewhat rushed, especially with the major error on B.

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    I think that tasks E1 and E2 are better suited for Educational rounds.They are pretty standard

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it +56 Vote: I do not like it

    Why E shouldn't appear on CF?

    • »
      »
      »
      15 months ago, hide # ^ |
      Rev. 2  
      Vote: I like it -23 Vote: I do not like it

      E1 is extremely straightforward and standard. It is an implementation exercise, and you can see that from the given points of 1000. I dont think tasks should award any amount of points, be it even 1000, just for being able to implement stupid bruteforces.

      E2 did not have any new ideas to me, and was just a test of "do you know how to maintain All Pair Shortest Distances" after adding an edge in O(n^2), which is why I also solved it within 8-9mins of finishing D.

      Overall, the task is way too standard, and I can see it being ok for div2/3, but it is definitely not ok for div1.

      • »
        »
        »
        »
        15 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        for me e1 was not easy. i spend hour and several submits (TLE). but my solution was not far away from e2.

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why does my E1 have TLE? I need an explanation

»
16 months ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

As a Python user, I know it is my fault but I HATE hacks against hash-based data structures :(

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Awwww my B got FST because of TLE what the hell??? Is the Counter lib from python collections vulnerable to hacks?

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

It seems that map passes test in B, whereas unordered_map results in TLE — I don't think this should be the case...

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

it feels so great to be hacked on b)))

hello, 2025

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it +6 Vote: I do not like it

    the hack exist is a thing, I only hope they put some in pretest so the cost of penalty wasn't this devastating...

    This is again much of a pain to bear in the start of 2025.

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    This not authors hacks.

»
16 months ago, hide # |
 
Vote: I like it +40 Vote: I do not like it

Thanks for the contest! I like pC very much.

But about problem E, I think it's quite bad to define path to allow going through same vertex multiple times, since it contradict the conventional definition of path, and it's better to call it a "walk" instead of "path".

»
16 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

All solutions for B using unordered_map are getting TLEs. Isn't it supposed to run faster than ordinary map or am I missing something here?

»
16 months ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

pls do something about problem c. though i used map and my solution got accepted but it is kinda sad for people who used unordered_map instead of map. c was a comparatively harder today making most of them solving only problem A and getting tle at B

»
16 months ago, hide # |
 
Vote: I like it +24 Vote: I do not like it

My screencast in rust

»
16 months ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

299698148 Can someone explain me why my B got TLE

»
16 months ago, hide # |
Rev. 4  
Vote: I like it +34 Vote: I do not like it

I had some seroius troubles with the TLs in this round. Sure, it is about kotlin, but I feel like it could have been a little bit more lenient.

D: The direct $$$O(6C3 q log n)$$$ solution with max-matrix should have passed. I don't think it should be cut.

E: I end up taking the clean $$$O(n^3)$$$ route. I am scared of $$$O(n)$$$ many 01-BFS on $$$O(n^2)$$$ edges, but perhaps I worried too much.

F: My solution that performs O(\log MAX n) ordered set operations are not fast enough, since in many cases I need to perform 3 or 4 searches for every "normal" operation. Though, I did not completely anticipate it being not fast enough, and would have opted for a segment tree/sorting+BS/BIT apporaches instead.

G: The overhead from declaring n different arrays was too much to handle, and I ended up needing to swap n, m when n is large. Allowing extra memory for this case would have been nice. I also see no reason to make the TL this tight -- it is not like there is any significantly easier solutions if an extra log or two are allowed.

Even though it is part of my issues for using Koltin and accepted the TL issues associated with it, I feel like in quite a few cases it was needlessly harsh.

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

What a nice start for 2025 (-_-)

»
16 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Are $$$O(n \cdot q)$$$ solutions expected to pass on E2?

I think the problem would have been better by only allowing $$$O(n^3)$$$ or $$$O(n^3 log n)$$$ solutions to pass, as it requires to do a workaround on the $$$O(n \cdot q)$$$ idea.

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    If by O(qn) you mean just “For every distinct state, check and answer every queries”(this is how I used it), then this can definitely pass, as the access patterns are very predictable (looping over all q queries). I worried less about this part than the actual $$$n^3$$$. I think a $$$n^3 log n$$$ is practically a lot worse than this $$$O(nq)$$$.

    • »
      »
      »
      15 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Yes, that's what I mean. Yeah I didn't even check how many operations was the $$$n^3logn$$$ (even without considering cache it's 3 times slower). My question was because I couldn't believe such a brute solution would pass.

      Although I still think the authors should have changed the limit on $$$q$$$ to either make $$$O(n \cdot q)$$$ pass comfortably, or make it TLE in order to force the intended solution (or the one with log).

»
16 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

hey codeforces pls tell me what is wrong with problem b i solved it in an efficient way but not the most efficient i did this way to make the implementation more easy for me i need just to say to me in the contest that the that my code has time limit exceeded on test 12 then i will make it more efficient i try to improve my self and my rating and suddenly i decrease in rating i need just someone to tell me what should i do i am bored from you codeforces i need to become an expert just tell me how with your stupid site

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    the issue is that you used unordered map. change it to a normal map and it will probably be accepted

    • »
      »
      »
      15 months ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      oh but the unordered_map is more efficient

      • »
        »
        »
        »
        15 months ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        normally unordered_map operation has O(1) time complexity and is more efficient but at worst case due to collision it can take O(N) time for simple operation testcases were designed in such way that collision happened

»
16 months ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it

Am I blind? I cannot find any information about upper bounds on $$$k$$$ in the problem statement for E1.

  • »
    »
    16 months ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    In the Input format: "Each of the following $$$q$$$ lines of each set of test case contains three integers $$$a$$$, $$$b$$$ and $$$k$$$ $$$(1≤a,b≤n, k≥1)$$$ — the next question. It is guaranteed that any path from vertex a to vertex b contains at least k edges" this is enough for upper bound

»
15 months ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Why was E1 worth just 1000 points?

»
15 months ago, hide # |
 
Vote: I like it -13 Vote: I do not like it

I love this contest because D and E are nice OI style problem

»
15 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

In problem B, in Python using Counter, for test case 17, there is TLE if we convert the input list into a list of ints, while there is no TLE if we keep the input as a list of strings. This probably happened because there is a hash collision when we convert input to int. I am unaware of any simple way to prevent hash collisions in python. Ordinary dict in python is also based on hash table; and we don't have an option like "map" from C++. Some other day, maybe the opposite can happen when the list of ints doesn't have hash collision while the list of strings does. Can anyone suggest how to prevent this issue?

»
15 months ago, hide # |
Rev. 2  
Vote: I like it +13 Vote: I do not like it

For E2, realizing that this is an MST problem was anywhere near standard to me, and many friends shared similar opinions. I was pretty excited about it when I realized it after the contest. What I was not excited about, however, was realizing that I was misguided in the time complexity analysis and wrote an $$$O(n^4 + qn)$$$ solution instead. Fortunately, this passed all system tests in the time limit and probably is actually just fast.

My excuse is that I'm bit dumbed down these days, and I also did this contest in a bench of an airport baggage claim area after a red-eye flight (worst environment ever I took a CF round!)

G was a standard construction problem. I have no problem with that; it was fun to think about.

Overall I enjoyed the round, thanks for the author!