dapingguo8's blog

By dapingguo8, 2 weeks ago, In English

Note the unusual time of the round.

Hello, Codeforces!

Tsinghua University’s Student Association of Algorithmic Competitions (THUSAAC) is pleased to invite you to participate in Codeforces Round 1092 (Unrated, Div. 1, Based on THUPC 2026 — Finals) and Codeforces Round 1092 (Unrated, Div. 2, Based on THUPC 2026 — Finals) on Apr/12/2026 08:35 (Moscow time). This round will be UNRATED for everyone. You will be given 3 hours to solve 7 problems for Division 1 and 6 problems for Division 2.

Please note that this contest contains at least one run-twice (communication) interactive problem. Please read the guides for run-twice problems before the contest if you are unfamiliar with them.

What’s more, it’s the first time that we will provide a local testing tool to help the contestants test their solutions on interactive problems. To get familiar with the testing tool, you may download the sample testing tool for an earlier interactive problem and an earlier run-twice problem. You can download them from the materials of the above problems.

Usage of the testing tools

Our team of amazing problem setters include: Warriors_Cat, E.Space, Ecrade_, SpiritualKhorosho, dapingguo8, xiaoziyao, Kratrissa, crazy_sea, zhouhuanyi, Doqe. Some of the problems prepared were not used in the final contest but we would still like to thank them nonetheless.

We would also like to express our gratitude to the following individuals:

  • KAN for helping to host the round;

  • Error_Yuan for coordination and helping with the problem preparation;

  • Alexdat2000 for translating the problems into Russian;

  • The team of problem setters for crosschecking the problems and also donghanwen, Iam1789, Zesty_Fox, sszcdjr, YuukiS, A_G, nifeshe, Caylex, a_little_cute, simplelife, Serval, wmrqwq for testing the contest and providing us very useful feedback;

  • Tsinghua University’s administration, especially our advisor Wentao Han for helping us in all means possible to ensure the smooth organisation of the whole THUPC event;

  • MikeMirzayanov for the amazing Codeforces and Polygon platform!

THUPC is an annual event hosted by Tsinghua University’s Student Association of Algorithmic Competitions (THUSAAC). It is the largest student-run competitive programming contest in China with the top 100 Competitive Programming teams from all over China coming onsite to vie for the crown of BEST CP Team in China after qualifying from a pool of 1000+ teams.

Moreover, this year is the 10-th anniversary of THUPC. Years of a decade have distilled countless brilliant and sparkling moments, and our gathering today is no less memorable. Our sincere gratitude goes to all staff and volunteers of THUSAAC. None of these glory would have been possible to be realized without your efforts!

By experiencing a series of collisions between intellect and joy, we hope you will enjoy and have fun in the contest. Good luck!

The scoring distribution:

Div. 2: $$$500 -1000-1750-2250-2750-4000$$$

Div. 1: $$$750-1250-1750-2750-3000-4000-5000$$$

UPD: Due to technical reasons, this round will be UNRATED. We are really sorry for any inconvenience caused by this :(

UPD2: Reasons of being unrated: The official contest started 3.5 hours earlier than the codeforces round. The problem statements unexpectedly leaked from the public scoreboard shortly after the official contest begins, and it spread a bit widely before the codeforces round begins, so the round can't be made rated now... We apologize for our mistakes :(

UPD3: Editorial

  • Vote: I like it
  • -112
  • Vote: I do not like it

»
2 weeks ago, hide # |
 
Vote: I like it +11 Vote: I do not like it

As a coordinator, THUPC is a good contest!

»
2 weeks ago, hide # |
 
Vote: I like it +74 Vote: I do not like it

Although I broke my arm before the first round of thupc thus losing the chance to participate the final contest onsite, I'll still participate it on codeforces. Good luck everyone.

»
2 weeks ago, hide # |
 
Vote: I like it -92 Vote: I do not like it

qp

»
13 days ago, hide # |
 
Vote: I like it -16 Vote: I do not like it

orz

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

Finally a communication problem for a Codeforces contest. And wait, is it a communication AND interactive problem?

»
13 days ago, hide # |
 
Vote: I like it -38 Vote: I do not like it

hope this will be easy for me

»
13 days ago, hide # |
 
Vote: I like it +15 Vote: I do not like it

I hope it goes well!

»
13 days ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

Hope theres no guessing problems

»
13 days ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

Though there're many tough days,I believe I can make it(to get higher rating and reach master!).

PS: I wish one day I can contribute my problem for the following THUPCs in the future!

  • »
    »
    13 days ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    Though there're many tough days,I believe I can make it(to get higher rating and reach candidate master!). :heart:

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

    Though there're many tough days,I believe I can make it(to get higher rating and reach expert!).

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

    Though there're many tough days,I believe I can make it(to get higher rating and reach candidate master!). :heart:

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

    Notes that the round is already unrated, Just relax.

»
13 days ago, hide # |
 
Vote: I like it -17 Vote: I do not like it

Why does it have to be on Easter?

»
13 days ago, hide # |
 
Vote: I like it +26 Vote: I do not like it

Hope not to solve 0 problems again.
I just want to have my usual behavior.

»
13 days ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Contest at lunch for me :D

»
13 days ago, hide # |
 
Vote: I like it -28 Vote: I do not like it

looking forward to contest, hopefully i can get till E without being goombah stomped though given my skills i doubt it

»
13 days ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

As a participant, I can feel that the contest is gonna be interesting.

»
13 days ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

I am familiar with interactive problems. But not with run-twice problems.:(

»
13 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Lets see how it goes ! GL!

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I hope that this contest is my Comeback contest.**I believe myself**.

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I hope it'll go well.

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

All the best.

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

THUPC competitions are always of exceptionally high quality, featuring problems that require deep thinking and successfully blend tradition with innovation. I look forward to this year’s event maintaining its consistently excellent standards!

I believe a well-designed problem set not only fosters greater growth among participants but also provides a more accurate reflection of their true skill levels. Lately, we’ve often seen contestants achieving high scores through the use of AI, and the reason is often that the problems lack depth, relying solely on excessive code volume to create difficulty. I believe a well-crafted problem set can also provide greater fairness for those of us who compete honestly!

On a side note: My teacher once said he would treat anyone at our school with a Codeforces rating over 2100 to a meal. I can’t wait to earn that treat! I hope THUPC will be the stage for this milestone achievement of mine!

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

The code provided for the local testing tool in the Link is a single line of text which Python isn't able to interpret. I got it reformatted from ChatGPT but that doesn't feel like the intended way.

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

    The download link seems to be broken. Here are the source codes:

    guessthenumber_testing_tool.py
»
12 days ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

For me,it's a friendly time!I don't need to stay up late!Brilliant!

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

6:35am guess im cooked :sob:

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

Good timing!

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

Finally I can participate a round in the afternoon! also I wish I could win Gaokao and enter THU... but I lost badly...

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Hope everyone enjoy the contest!

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

morning round, finally

»
12 days ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

4 hours left. Where’s the score distribution?

»
12 days ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

This is the first competition I have participated in

»
12 days ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

My first contest since feburary!

»
12 days ago, hide # |
 
Vote: I like it +33 Vote: I do not like it

I've been waiting for days to this contest and now is unrated

»
12 days ago, hide # |
Rev. 2  
Vote: I like it +64 Vote: I do not like it

This reminds me of last year's Zhili Cup. It looks like some kind of curse; any THU contest on Codeforces is very likely to be unrated because of some unexpected events. This is truly unfortunate.

»
12 days ago, hide # |
 
Vote: I like it +42 Vote: I do not like it

Ffs why is this unrated now, I woke up early for ts and now it’s unrated

»
12 days ago, hide # |
 
Vote: I like it +51 Vote: I do not like it

As a PKUer, I want to condemn THUSAAC for causing me to lose the opportunity to become candidate master.

»
12 days ago, hide # |
 
Vote: I like it +12 Vote: I do not like it

RagebaitForces

»
12 days ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

Morning warmup round I guess

»
12 days ago, hide # |
 
Vote: I like it -16 Vote: I do not like it

CHINESE PROBLEM SETTER :O MUST BE HARD THAN AS USUAL DIV2

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

even if it’s unrated, I’m still willing to participate

»
12 days ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Let's put the link of leaked problems here and look forward to a nice result of the unrated round.

»
12 days ago, hide # |
 
Vote: I like it +29 Vote: I do not like it

The only competition that fits my schedule has also been unrated…

»
12 days ago, hide # |
 
Vote: I like it -7 Vote: I do not like it

I would've had to skip lunch to give this contest.

Sadge, it became unrated. But hey I'm gonna go have some food now!

»
12 days ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

Woke up early today for this contest, now I can go sleep again!

»
12 days ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

It was my 1st Div.1 contest and sad to see that it's unrated :(

»
12 days ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

why it is unrated?

»
12 days ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

What means "technical reasons"?

»
12 days ago, hide # |
 
Vote: I like it +28 Vote: I do not like it

Back to sleep.

»
12 days ago, hide # |
 
Vote: I like it +20 Vote: I do not like it

Waking up early for a rated round only to see it become unrated is a bit disappointing, but ensuring fair competition is always the right call. Thanks to the technical team for their hard work.

»
12 days ago, hide # |
 
Vote: I like it +12 Vote: I do not like it

they should've careful about sharing questions. i didn't wake up for unrated contest. but thanks anyway for your hardwork.

»
12 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

where it got leaked?

»
12 days ago, hide # |
 
Vote: I like it -9 Vote: I do not like it

Where is the "fun" you've given me?

»
11 days ago, hide # |
 
Vote: I like it +5 Vote: I do not like it

Nice pun in the name of div1E.

»
11 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why are you cheating on an unrated round???

»
11 days ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

Div1 D and E should be swapped.

»
11 days ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Did a 3-hour contest only to find out it was unrated. Should’ve just slept.

»
11 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Do not use vector on Div.1 B or you will get TLE :(((

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

How to solve Div1E?

  • »
    »
    11 days ago, hide # ^ |
    Rev. 2  
    Vote: I like it +6 Vote: I do not like it

    Consider lining the points by $$$x_i$$$ ascending. From front to back, if there's a peak, add the triangle and smooth out the point(line $$$i-1$$$ and $$$i+1$$$) and repeat the same process for the valley, just like polygonal triangulation.

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

Testcases in problem B are weak

370786015 fails on this test:

1

999999572915

Answer should be 9, my solution gives 8.

»
11 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve D2E / D1C... is it something related to topological order or something constructive.

  • »
    »
    11 days ago, hide # ^ |
     
    Vote: I like it +7 Vote: I do not like it

    Assume vertices are 0-indexed. The goal is to assign 0/1 color to each vertex, such that the sum of color[i] * 2^i = s. For every vertex, you know its desired final color. When you get an edge u, v you direct it from min(u, v) to max(u, v) if color[u] = color[v], and from max(u, v) to min(u, v) otherwise. Since color[n — 1] = 0, you can reconstruct the color array

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

    We noted that the range of the num is 1~2^n ,the first step is to take the number down by 1. It is to ensure that the nth bit is always 0

    Now we can rebuild the tree in this way. If we have 1 edge and two endpoints called u v ,if the uth bit and vth bit of s are the same,we make the direction of edge from max(u,v) to min(u,v) .if not we make the direction reverse. (You can check it by check the xor value of them).

    Once we rebuild the tree in this way ,we can restore the orignial number by the basic dfs ,start with point n,checking the edge direction,and we can restore each bit value of the number.

    In this way we get the orignal number,don't forget add 1 to it before you output.

    I hope this text can inspire you! Hope you enjoy your day.

»
11 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

This contest is really interesting.

»
11 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Who also felt that div2B is quite annoying, it took me more than 2 hours to solve it :(

»
11 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

This contest was so good, except that it was unrated :(

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

Thank you for the problems, especially the communication problem (Div1C) =)

»
11 days ago, hide # |
 
Vote: I like it +10 Vote: I do not like it

Div1 D is so weird, I guessed that the distance should always $$$\le 12$$$ and directly passed?

How can we explain that?

  • »
    »
    11 days ago, hide # ^ |
     
    Vote: I like it +18 Vote: I do not like it

    Now I know. My submission has been hacked.

    • »
      »
      »
      11 days ago, hide # ^ |
       
      Vote: I like it +8 Vote: I do not like it

      POV of "I'm sure it will pass system tests" coders.

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

        A somewhat valid one nowadays with little difference between pretests and systests. Not like those past uselesspretestsforces rounds were good but this sounds like a case that's easy to countertest so it should at least have a counter in systests.

»
11 days ago, hide # |
Rev. 2  
Vote: I like it +6 Vote: I do not like it

I created video editorial for C. Interval Mod and video editorial for D. RReeppeettiittiioonn

»
11 days ago, hide # |
Rev. 2  
Vote: I like it +3 Vote: I do not like it

Can someone please tell me why is my solution wrong for B 370775032. My logic was, since using T and U together saves us most space, we always pair them first and then if no T is left, the answer is 3*(H + U). If T is left, then we have a choice, EITHER we pair T and H (taking 5 space) and then take care of remaining T or H (for H it will be 3 per item and for T we can pair it with itself and add 3 if its odd) OR we first pair T together with itself and add 5 for last one (if odd) with H, and then add 3 per H left, we take the minimum of these two values.

  • »
    »
    11 days ago, hide # ^ |
    Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    for input:

    1

    2 1 0

    it gives 5 instead of 7. After packing T and U (size 4) pack THT (size 7) and then remaining k * T for cost 2 * k + 1

  • »
    »
    11 days ago, hide # ^ |
    Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    I also used similar approach mine also failing. Two cases to consider when T,H remains and U finished.

    case1: pair TH then invert T (7 rows ) then either H finished or T finished. if T finished it’s H*3, if H finished pair T’s horizontally 2*T+1 rows

    case2: pair T’s horizontally 2*T+1 rows. pair H’s 3*H rows. if one T only then consider merging it with first H then all Hs.

    Then we take min of case1 and case2. And add to initially combined U and Ts.

    And if U and H remains T finished it’s simple total count of H and U*3 because H and U cannot be combined.

    • »
      »
      »
      11 days ago, hide # ^ |
      Rev. 2  
      Vote: I like it 0 Vote: I do not like it

      nvm i got it. there was a silly mistake in case1. i forgot to add 3 when pairing with 2T and 1H lefts us exactly 1T.

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

      I was not able to deduce that case 2 can be less than case 1 as per your solution can you think of a tc where this happens

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

    You can try this test case: 1 2 1 0

    Your code will print 5, while the correct answer is 7. Also, you can see that 2 Ts and 1 H only need n = 7 for them to fit, not n = 8.

»
11 days ago, hide # |
 
Vote: I like it +41 Vote: I do not like it

Too sad that this round became unrated...

»
11 days ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Interesting problems, sad that is was unrated. (Or good because I suck.) Waiting for editorial...

»
11 days ago, hide # |
Rev. 2  
Vote: I like it +5 Vote: I do not like it

Please Explain how in Div2C testcase 5 is having answer 4 ??

I can't figure it out ???

Please Help

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

    You can first select [1,4] and mod 3 turn it to 0,1,2,0,100,78,4

    Then select [4,7] and mod 5 turn it to 0,1,2,0,0,3,4

    Then select [4,7] and mod 3 turn it to 0,1,2,0,0,0,1

    Sorry for poor English

    • »
      »
      »
      11 days ago, hide # ^ |
      Rev. 2  
      Vote: I like it 0 Vote: I do not like it

      can we not just mod every a[I] with either p or q until a[I] is less than both p & q? If I am wrong please correct me. for example : ll sum = 0; for (ll i = 0; i < n; i++) { while(a[i] >= min(p,q)){ a[i] = min(a[i]%p, a[i]%q); } sum += a[i]; }

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

        U need to check for a subarray of atleast k size

        There will be different cases made out from here

        Though I couldn't solve but i really believe my approach was not wrong at all

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

      Ohh man!!

      I really tried hard to apply dp soln

      But now i got it what went wrong

      Thanks a lot !!!!

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

    div 2c? I am also not able to figure out... for test case 5 I am getting 584 instead of 569

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

Anyone can tell the ratings of problems a,b,c , were quite easy however i found d difficult even thou it got solved by quite many?

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

    Same

  • »
    »
    11 days ago, hide # ^ |
    Rev. 2  
    Vote: I like it +3 Vote: I do not like it

    Personally I think problem D is easier than problem C; it only took me about half the time of problem C.

    Spoiler: Perhaps noticed this helps me solved D quickly.
    • »
      »
      »
      10 days ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      ooops! I didn't notice this and solved the problem in $$$O(d(n)+n^{1/3})$$$, where d(n) means the number of factors of $$$n$$$,$$$\le 7000$$$ when $$$n\le 10^{12}$$$.
      This algorithm can actually solve the problem without the condition $$$\sum n\le 10^{12}$$$.

»
11 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Will the problems appear in the problemset/be given ratings?

»
11 days ago, hide # |
 
Vote: I like it +19 Vote: I do not like it

Editorial pleaseee

»
10 days ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

Where's the editorial?

»
6 days ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I like contests that dont start at midnight :)