fengzhengwei's blog

By fengzhengwei, 13 months ago, In English

There will, and there shall be a THU round!

Nihao Codeforces! After the unfortunate event which led to Codeforces Round 1010 (Div. 1, Unrated) and Codeforces Round 1010 (Div. 2, Unrated) being unrated last week, we’re back and stronger than ever!

Tsinghua University’s Student Association of Algorithmic Competitions (THUSAAC) is pleased to invite you to participate in Codeforces Round 1012 (Div. 1) and Codeforces Round 1012 (Div. 2) on Mar/23/2025 08:35 (Moscow time). This round will be RATED for everyone. You will be given 2 hours and 30 minutes to solve 5 problems for division 1 and 6 problems for division 2, and two of each will have subtasks. Note the unusual time of the round.

Our team of amazing problem setters include: Iam1789, Ecrade_, E.Space, QuietBeautifulThoughts, gyh20, SpiritualKhorosho, dapingguo8, myee, abruce, _Lucien. 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:

THUPC is an annual event hosted by Tsinghua University’s Student Association of Algorithmic Competitions. 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.

We hope you will enjoy and have fun in the contest. Good luck.

UPD: Here comes the scoring distribution.

Division 1:

$$$750+(1000+500)+(1000+1250)+2500+3000$$$

Division 2:

$$$500+1000+1750+2000+(2000+1000)+(2000+1500)$$$

UPD2: Congratulations to the winners!

Div.1:

  1. tourist

  2. ecnerwala

  3. jiangly

  4. ksun48

  5. JDScript0117

Div.2:

  1. liudiao

  2. lnw143

  3. ilovelll

  4. boboquack

  5. Madeeyuth

UPD3: Editorial

  • Vote: I like it
  • +446
  • Vote: I do not like it

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

based

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

Hope you all enjoy our contest :)

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

hope the contest will be held successfully this time :D

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

As a participant who has taken part in the preliminary contest but failed to enter the finals, I will reach CM again in the contest.

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

thu rounds, best rounds!

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

As a participant, I hope the problems are cool!

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

Auto comment: topic has been updated by fengzhengwei (previous revision, new revision, compare).

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

Cool!

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

expecting a good round

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

I hope it goes well.

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

orz fengzhengwei

I am your biggest fan!

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

THU never makes me disappointed!

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

It seems that I got another opportunity to participate in Codeforces with pay while on the job.

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

Where is the score distribution?

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

Isn't the number of testers of this round quite low? Especially for a div. 1 round.

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

Score distribution?

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

please add scoring distribution

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

Hopefully, this round will not be postponed and then unrated at the same time like the last unusual scheduled round...

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

Are the questions sorted by difficulty?

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

Auto comment: topic has been updated by fengzhengwei (previous revision, new revision, compare).

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

Auto comment: topic has been updated by fengzhengwei (previous revision, new revision, compare).

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

Waiting for guests to leave so that i can attend the contest ;sob

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

The best coders in the best university in China can NOT EVEN COUNT THE EXACT NUMBER of problems.

Sad.

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

first time div.1!

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

Auto comment: topic has been updated by fengzhengwei (previous revision, new revision, compare).

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

hard c

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

Good luck everyone, glad we can have a late night contest.

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

extra registration please?

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

why can't i register omg :sob:

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

Is there no extra registration?

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

What if I forgot to register? Can I still participate?

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

extra registration?

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

    FairyWinx please open the contestttttttt, hedging myself rn by doing the problems but dont want to waste my time

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

is C correct?

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

Why where is no extra registration?

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

Why no extra registration and also registration closed at 11:00 and contest started at 11:05. I wanted to participate :(

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

Why is there no extra registration? I wanted to participate :(

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

As an onsite contestant, the lunch is McDonald's and they provide better meal than Zhili Cup(which is 1+1=13.9 combo).

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

    As an online contestant, I didn't get any free lunch nor dinner. I'm hungry now.

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

how does my C run in 78ms :D ?

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

Um, I feel bad about D1 A.

The limit $$$\lfloor \frac{n}{3} \rfloor-1$$$ misled me.

When I saw the limit, I considered dividing the permutation into $$$\lfloor \frac{n}{3}\rfloor$$$ groups with size $$$3$$$. That wasted much time.

But the true answer is around $$$\lfloor \frac{n}{2}\rfloor$$$.

If the limit is $$$\lfloor \frac{n}{2}\rfloor-100$$$, I can solve the problem much faster.

Did there anyone have the same experience as mine?

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

    Insert smug face.

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

    I also didn't understand why the bound was like that. So I just ignored it and tried to think of maximizing number of primes.

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

    its actually doable for n — 2 * primegap(n) i guess

    this is a lesson not to guess from limits..

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

    I thought that we can use the fact that for all $$$m$$$ there is at least one prime $$$p$$$ such that $$$m \lt p \lt 2m$$$, so in our case, we can take $$$m=\lfloor\frac{n}{3}\rfloor$$$ and be sure that there is a prime in the double that interval, so we can actually easily prove this tight bound and the proof of the more loose bound is not that straight forward, or it is?

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

    maybe im missing something but floor(n/2)-c seems like a bound that wouldn't work for a problem no matter the constant, the biggest answer you can get for any given in is (ignoring exact indexing here) n/2 — distance from the midpoint to the closest prime

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

D surprisingly easy, could've swapped place with C.

C easy on the logic, but hard on the implementation (or I'm just over complicating things).

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

Div2C today = implementation skill issue.

WA/TLE/RTE for no real reason, oh well...

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

Wow I hate 1B

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

    also B1 >>> C1 like wow i found C1 so so much easier

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

      As someone who solved B1 but not C1, I disagree

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

      ok what the fuck was i doing for B1 ......... MY B2 IS WAY SIMPLER LIEK I KNEW YOU COULD SIMULATE IT BUT I COULDNT FOUND A WAY TO SIMULATE IT FAST ENOUGH EVEN THOUGH IT'S LITERALLY RIGHT IN FRONT OF MY FACE

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

Why can't I see others' code?

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

Is it just me or in div. 2 D felt easier then C?

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

any tips for c?

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

tho I lost expert, but I loved problem C for some reason. especially after getting one the fastest solutions for the problem

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

C2 is very nice, but unfortunately I thought of wrong solution and spent half contest implementing..

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

Become IGM probably. I've come up with the solution of C2, but it's too hard for me to implement.

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

Is C not meant to be solved by maintaining tables and the count of people sitting at a table? I used a std::set<std::array<int, 3>>> and suffered TLE

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

    Dont go for n*n Try around (sqrtn +k)*(sqrtn+k)

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

    the order can be pre-computed. Note that in a table if we know the distance for the bottom left cell of a table, then we can calculate further distances like this

    d + 1 | d + 4
      d   | d + 1
    

    where d is the distance of bottom most cell. now the order will always be in diagonal order (draw to note this).

    the only exception will be the top right cell. if we consider the table above the current table in the next level diagonal, then the top right cell of current table comes before the bottom right cell of that table. knowing this, we can pre compute orders and then simply place the people

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

After solving B2, I accidentally submitted it to B1, so my total score for B1 and B2 ended up being lower than before submitting... (early B1 > late B1+B2). Sad lol. (Mistakes like this are irrecoverable, right?) Fortunately, it looks like my ranking didn't change.

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

Sorry but how did the statement of D1C get approved?

The statement has critical information spread between utterly irrelevant story lines to the point where its extremely irritating to read (at least for me).

I understand that the problem setters sometimes want to associate a story with a problem, but on CF its usually:

  • Natural and short (1-2 sentences) enough that it works as the problem definition.

  • Added as a paragraph before the formal definition so that you can skip past it.

This statement does neither of these. Instead you have utterly useless lines like To remind the correspondence, M's mother adorned each key with a gemstone of a different type. between actually critical information that makes the reader think this will be relevant to the problem when it isn't in the slightest.

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

    I agree, reading it gave me an aneurysm lol (especially since usually all problems have stories or none of them do)

    the problem itself is fine though imo

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

    As someone who didn't try the question after reading it,

    It was a nice story.

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

    "The keys are distinguishable" isn't useless information to put in a statement, it's just phrased in the context of the story instead of in math language. The statement similarly mentions that the locks are distinguishable.

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

    I can't agree with you more.

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

codeforces

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

Setters, literally messed up with problem c there,

  1. first of all, problem statement had a fatal mistake for interchanging values of t = 0 and t = 1
  2. problem statement did not mention what does distance to table means, later it was stated in announcement
  3. announcement also had mistake -

it stated — For the fourth guest, distance to cell (1,4) is 4, so they chose it, For sixth guest distance to cell (1,5) is 6, does that even make sense!

they later fixed this 6 to 5. Making mistake while correcting a mistake in a round with 10 >= master level setters sets me low :(

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

In Div2C, can someone please explain, why we place on (1,5) and not (2,2) ?

Aren't we simply taking Manhatten distance ?

For the sixth guest, the distance to cell (1, 5) is 6, the same as to cell (2, 2), but since the x-coordinate is smaller, they choose it.

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

2C wasn't explained well, lost a lot of time because of it

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

Has tourist achieved Rank 1 this time ?? Finally #2 curse broken !!

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

Yet another speedforces round. Failed to get to IGM :(

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

How to prove Div1A? I just guessed a solution of doing the following three conditions repeatedly which got AC:

  1. If there is a value which will result in the smallest remaining prime, do so using the smallest such value.

  2. If all numbers overshoot the prime, then increment the smallest prime.

  3. If all numbers undershoot the prime, then just put the largest remaining value.

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

    I took the prime 'p' closest to (n/2) and used the sequence p, p — 1, p + 1, p — 2, p + 2... until I got the required number of primes in c.

    This works because the prime gap between the two primes closest to (n/2) is not larger than n — #primes in c. Prime gap, gn is pretty small for the input n. I guess it doesn't exceed 148 from what I can see on the gn table on Wikipedia, because gn is 154 for the prime 4,652,353.

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

      take a prime p in ($$$n / 3$$$, $$$2 n / 3$$$) was the clever part. rest $$$p - 1$$$ , $$$p + 1$$$ , ..

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

    Did the exact same thing. Experiemented with some numbers when everything undershoot the prime and LUCKILY the largest remaining value worked.

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

Great contest! But the statements could be more clear.

  • A: Decent number theory A, exactly at its place
  • B: Slightly unclear statement about pushing the balls, I had to spent some time to figure out why the last testcase was "NO"
  • C: I believe the distance definition turned out to be unclear. That is, there was no definition of distance at all. About the problem, I thought at first that the tables would tile a square. After WA I figured, that the triangle would be optimal, not square, so there was a plot twist!
  • D: The first problem that I solved by coding different approaches first. I'm kinda curious now if I could've solved it developing a math model first.

Sadly, there were not that many participants as usual. I randomly got enough sleep today, woke up quite energetic and participated in the morning contest at my timezone. And I don't regret it!

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

    C. the distance is implicitly stated as the guest can only move 4 cardinal direction.

    F. has good story, guy eating ratatouille moment there.

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

      the distance is implicitly stated

      Distance was indeed implicitly defined. And that what I meant that there was no definition, as a definition is generally explicit)

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

bad statement.

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

I passed simulation with bitsets in Div1B, basically maintaing bitsets of non-zero elements of both arrays, and every time only perform operations on such indices where both $$$a_j \gt 0$$$ and $$$b_i \gt 0$$$ (finding so by doing AND of bitsets). What is an asymptotics of maximum number of operations that can be done by this solution (by operation I mean substracting non-zero from $$$a_j,b_i$$$)? Is it something reasonable, or I was lucky?

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

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

I read div2 c completely from the announcement

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

Hey, can anyone proof my div2 D, just luckily got AC after 10 pen ToT.

my submission
»
13 months ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How to solve Div2 E1 ?

I wrote a brute force solution but it got TLE on test 25 :(

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

    sounds like my brute force is smarter xD

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

    Optimize brute force a bit, by remember next[i] and its left over sum.

    I've TLE on test 25 and tried to optimize bf too. Works

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

Tanks for making this unrated. I'm sure there's a lot of people who got stuck on C.

Also, a stupid question, was the ceiling sign always there?

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

Weird constraints of B.

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

Reading 1C1/2F1 be like, am I taking somewhat english reading comprehension exam right now

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

There is a whole paragraph in D1C :skull:

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

problem D , find a prime number p in ($$$n / 3$$$ , $$$2n / 3$$$) (guaranteed there exists a prime) . Now put $$$p - 1$$$, $$$p + 1$$$ , $$$p - 2$$$ ,$$$p + 2$$$ , ..... and place remaining numbers. At sufficient number of even positions we have $$$c[i] = p$$$

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

Congrats! 8th grader JDScript0117 gets 5th place in div1 !!!

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

This contest was so wack for me, missed B and C and solved in A -> F1 -> D order then was too slow on C.

I guess the fact that C,D,E1,and F1 are all within 250 points of each other makes for a weird dynamic since there's a real strategic decision to go for certain tasks first since they're all supposedly nearly same difficulty according to point spread but at the same time it's weird to be 1600 and somehow miss a Div2B and Div2C just simply because this round gives a lot more options than your usual CF round.

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

As participant, I hope I don't see these kinds of contests in the future

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

Can someone please tell why does this get tle how do i optimise this solution

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

Is anyone able to determine why my submission for Div2C: 312026477 is wrong?

My logic was to use two priority queues to maintain available seats, one for the 1s and one for the 0s, then when a 1 enters, ensure that the first available seat in the pq wasn't already taken by a 0 previously. I couldn't get past pretest 2.

I had also defined a custom comparator to order the seats appropriately based on Manhattan distance.

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

DIV2 B can someone check why my code getting WA on TCase 4?

Logic was if arr[i][j] == 1 and either there is a 0 on top of it, then there should be 1s continuously appearing to the left of it and if there is a 0 on the left of it, continous 1s should be there on top of it (starting from the 0th row).

312042843

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

    You are missing the case when both left element and upper element are 1's.

    check this case out :

    3 3 010 111 011

    The 1 at (3,3) is assumed to be valid according to your code but it isn't.

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

Can someone try to hack this

I just find next alive b for each ai, but i think it's possible to chain ai's with bi's and force the solution to be n^2

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

    Hey it's provable that it passes. consider the set of good indices as indices in array A and array B that are non zero. (so initially there are 2n such indices)

    and the round indices are the set of good indices that change in round r.

    now since you maintain a set you're only visiting the good indices in the round r and kill at least half of it. (at least one from each pair for the current round)

    since there are only 2n indices to kill your solution doesn't make more operations than 2n!

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

      how do you take into account the case when he pops some {$$$ai, bi$$$} but that $$$bi$$$ was already $$$0$$$ so he just changes the $$$bi$$$ for that $$$ai$$$ and pushes into set again. Can you prove that these reattachments will be bounded by $$$O(n)$$$ and not go $$$O(n^2)$$$ (which I believe was his main confusion).

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

As someone who skipped school today -18 rating isn't what I expected.

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

I love THU round! XD

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

div2.D is a really tricky problem.

I used 1h time to think about random algorithms(that is because I used ramdom_shuffle() to solved div2.C before).I also used 30min time to think about why the 2,1,3,4,5,···,n was wrong.Almost the end,I thought about the correct solution.

PS:the samples are very confusing,I believe many people tried the 2,1,3,4,5,···,n first and got WA on test 8.

If you think I am wrong,don't downvote please

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

In Div.1 E, accroding to validator, sum of N is guaranteed to be less than 80. And its not shown in the statements.

If the validator was corrected to fit the statement, only jiangly's code will be able to pass (125ms *10 = 1250ms), among all 4 accepted codes till now.

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

When/where editorial?

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

My solution for B: For every row and column count blocks of '1' which should either be 0 or if 1 should be tied to the beginning of the row or column for a valid insertion of balls in the row or column. Finally, go through the grid again and wherever a ball is present check if the insertion of balls is valid or not along the row or column. Answer should be 0 if found invalid along both ways. Is this wrong or is my code wrong? code

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

Damn, the problem statement of d2c is so hard to understand.

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

Hi, when will the editorial be posted?

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

I need tutorial.

qwq

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

When solution? I really want to know how to solve 1B / 1C though I didn't participate it

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

    Div1 C1 is a nice problem; I actually solved this in contest but the idea was unfortunately too slow to extend to C2. While you're waiting on the official editorial, here's a quick hint for C1.

    Hint 1
    Hint 2
»
13 months ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

When is editorial coming out

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

how to DIV2 C?

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

Hi. Are you planning to release an editorial soon ?

Can someone explain div2 E1 and E2 ? please :D

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

    You want to find out in which operations there are some non zero values in a matched with non zero values in b. At most you can have 2n of this instances since every time there is a match at least one number becomes 0.

    You can do this by keeping a set of active (non zero) aIndexes and active bIndexes, you also have an offset which represents the current offset of the aIndexes. Now you calculate the necessary offset for each active aIndex to meet with an active bIndex (using binary search in logn). Next, in each update you go the next offset which gets you a match and if the a that match remains non zero you look for its next matching active bIndex.

    For E2 you can do almost the same thing, you only need to also keep track of the sum of all active 'a's, and stop when their sum becomes equal or less than k.

    Here's my code 312026398

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

Where is the Tutorial?

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

In Div2D, I solved it by picking a prime $$$p$$$ in the range $$$\frac{n}{3} \lt p \lt \frac{2n}{3}$$$ as the first number and then alternating as:

$$$ p-1,\; p+1,\; p-2,\; p+2,\; \dots $$$

Proof:
Case 1: If $$$\frac{n}{3} \lt p \le \frac{n}{2}$$$, then

$$$ c_i = \left\lceil \frac{S_i}{i} \right\rceil = \left\lceil \frac{i\cdot p - x}{i} \right\rceil, $$$

with $$$x \lt i$$$ ensuring $$$\lceil c_i \rceil$$$ remains prime for several steps (until $$$p-x \lt 0$$$). Since $$$p \gt \frac{n}{3}$$$, we get at least $$$\frac{n}{3}$$$ primes.
Case 2: If $$$\frac{n}{2} \lt p \lt \frac{2n}{3}$$$, then

$$$ c_i \text{ is prime until } p+x \gt n \text{ or } x \gt n-p. $$$

Since $$$p \lt \frac{2n}{3}$$$, we have $$$x \ge \frac{n}{3}$$$, yielding at least $$$\frac{n}{3}$$$ primes.
Does this look correct? Also, is there a way to maximize the number of primes in this construction?

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

    Here's the closest to optimal as possible as I can find:

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

Still Waiting for the tutorial.

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

I recently got a notification that my Codeforces solution 312004364 for the problem 2090D coincides with others, so I just wanted to clear things up.

When solving the problem, I referred to some code I found online(https://www.geeksforgeeks.org/minimum-absolute-difference-of-a-number-and-its-closest-prime/?ref=ml_lbp) with minor adjustments to understand the approach better. I didn’t think much about it at the time, but I now realize that since others might have used the same sources, it ended up looking similar. Definitely wasn’t my intention to copy or break any rules. Note: I made some changes to the code referenced above after its understanding. So , I assure you that such similarity arose purely due to coincidence. I hope everyone understands.

I will make sure to write solutions more of my style going forward. Lesson learned definitely.