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

Автор Theo830, 3 года назад, По-английски

Γεια σου (Hello), Codeforces once again!

Adam_GS and I are glad to invite you to participate in Codeforces Round #912 (Div. 2) which will take place on Nov/30/2023 19:35 (Moscow time). Note the unusual start time of the round. As usual, this round will be rated for participants with rating lower than 2100.

Problems were created and prepared by Adam_GS and me. We tried to make them interesting, with short and clear statements. We hope that you will enjoy them!

I would like to thank:

  • ScarletS for amazing coordination of this round.
  • Adam_GS for joining as an author after testing the contest.

You will be given $$$6$$$ problems (and one subtask) and $$$2$$$ hours and $$$15$$$ minutes to solve them.

The score distribution will also be announced shortly.

Good luck and have fun!

UPD1:

Score Distribution: $$$500-1000-1500-(1500-2500)-2250-3500$$$

UPD2:

Editorial

UPD3:

Congratulations to the winners:

Div2:

  1. DoIodu123

  2. 69JohnMouse69

  3. transfeft

  4. vflower

  5. Top2Greece

Div1 + 2:

  1. Um_nik

  2. ecnerwala

  3. Ormlis

  4. tourist

  5. noimi

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

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

As a tester,the problemset is superb!Hope you enjoy it :)

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

As a tester , I wound recommend to read as many problems as you can

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

Nice to see a round from a person(Theo830) who was sitting to my left on IOI2023 :) And a Person(Adam_GS) Against whom I played Table tennis :))

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

As a tester i can say that the problems are fun and interesting with a Cypriot twist ;)

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

Good luck everyone ^_^

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

Tomorrow I will understand how bad doing contest late(like Chinese).

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

I might give this round and solve D1-D2

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

According to score distribution, D2 >> F .

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

As a tester, I wish you all good luck!

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

As a tester Cypriot, I hope that statements are short and pretests are strong, making our tiny island proud!

ps. I will be competing so if I lose rating Theo830 pls make it unrated

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

As a tester, I confirm the problems are interesting... hope y'all have a positive delta!

»
3 года назад, скрыть # |
 
Проголосовать: нравится +14 Проголосовать: не нравится
Div.2- F
»
3 года назад, скрыть # |
 
Проголосовать: нравится +18 Проголосовать: не нравится

My sleep and the contest are at crossroads today. I will choose the contest.

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

GLHF

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

Guess — D1,D2 can be dynamic programming with varying constraints.

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

As a tester

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

As a tester, certain problems are, for the lack of a better word, based.

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

At least i can blame sleep deprivation if i mess this round up

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

The start time is 00:35 for me, so I can sleep well

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

The timing of this round is awful for Chinese students, I hope I won't be late for class the next day

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

contest >> sleep >> university exam

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

The first, I will be giving a contest at 10:05pm(India)

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

Hi

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

Hoping to become a Pupil after today's contest

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

As a farmer, I mean tester.

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

W cyprus round

orang soon?

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

Nice problems. I got 5 wrong answers and wasted 1 hr for a simple integer overflow bug in D, could've been a good contest for me.

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

$$$E$$$ was easy to solve, but hard to implement. Thanks for cool tasks!

UPD. After checking some submissions, i can say that i am just noob and E wasn't hard to implement:)

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

balanced contest with good problems

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

What the fuck is a pretest number 15 anyway

Man I had such high hopes for D2, unlucky

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

What was the approach for C?

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

Nice E!

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

Solved A,B and C. But I feels C is slightly easier than B

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

Problem C and Problem D in CF EDU 66 are the same actually, isn't that enough to make this round UNRATED?

Problem D code
Todays Problem C code
»
3 года назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Come on!! The solution to Problem B was uploaded on Youtube around 40 minutes before the contest ended. That would explain the sudden rise in submissions (700+) on Problem B in the last half hour. Disappointed ://

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

Not sure about visiting Cyprus after this contest

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

Great problems! Keep it going. Would love to see a div1+div2 from you next time!

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

Missed Specialist just for a minor fuckup!!

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

E is a really cool problem, I love how the winning condition is so simple and easy to prove.

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

Any hints for D2?

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

Ahhhh....Thursday....watching my favorite anime characters and my rating go down....what can be better?

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

any hint for problem C ?

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

what is the idea in problem C?

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

Where can i find official solutions for this contest ?

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

I solved B but I don't know why it works, hopefully, system test passes :D

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

misunderstood problem C summation (len of subarray_i) * sum_i :(

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

got AC in problem C without knowing what exactly I was doing LOL. Maybe it will be hacked

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

If you want to build intuition for problems like today's C. Theofanis' Nightmare, try upsolving 1132F: Clear the String. I was lucky to have upsolved it very recently and the idea instantly clicked :) (I've also added hints for 1132:F if you don't want to read the editorial.

How does intuition from one transfer to the other?

Submission

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

What is the intuition behind Problem B?

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

Amazing round, loved solving the problems!

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

I overcomplicated C to a stupendous degree. Looking at everyone else's submissions, simply going from the back was enough. I instead viewed it as $$$\text{psum}[a_1] + 2(\text{psum}[a_2] - \text{psum}[a_1]) + 3(\text{psum}[a_3] - \text{psum}[a_2]) + \dotsc + k(\text{psum}[a_k] - \text{psum}[a_{k-1}]$$$, then expanded it to yield $$$-(\text{psum}[a_1] + \text{psum}[a_2] + \text{psum}[a_3] + \dotsc + \text{psum}[a_{k-1}]) + k \cdot \text{psum}[n]$$$,

then I iterated over $$$1 \leqslant k \leqslant n$$$ and chose the $$$k-1$$$'th minimum values of the prefix sum in order to minimise $$$\text{psum}[a_1] + \text{psum}[a_2] + \text{psum}[a_3] + \dotsc + \text{psum}[a_{k-1}]) + k \cdot \text{psum}[n]$$$, and summed them.

The way I did this was sort the prefix sum and create ANOTHER prefix sum for that prefix sum. It got pretty damn hectic.

235105543

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

D1 using binary search?

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

Legit random solution for F or weak systests? (Enjoy to hack)

Add all vertices to the set of answer. Repeat the following sufficient amount of times:

  • Find minimum difference between to vertices in the set
  • Randomly delete one of them, and add all vertices incident to it to the set

https://codeforces.me/contest/1903/submission/235123989

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

Tried solving D1 using this approach: While iterating from higher order to lower order bits, say you are at bit bit. Then, you check the current bitwise AND for that position. If it's not one, and we can make it 1, we should. So, for every $$$a[i]$$$ which doesn't have the bit position set, we set it. To set it, we look at its bit - 1 bit. If it is set, then we need to add $$$2^{bit - 1}$$$ (i.e, we are borrowing from the neighbor while clearing the neighbor's bit). If the neighbor is not set, the cost has to be $$$2^{bit}$$$.

Can anyone please point out the flaw with this strategy?

Submission

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

    Suppose the bit-2 bit was set, then you need to add $$$2^{bit} - 2^{bit-2}$$$. In general, you need to check all the bits with lower value than the current bit, not just the next one.

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

      Ooof, how did I miss that? Thanks. Fixed Submission

      I guess I got too involved with figuring out the borrowing strategy that I overlooked this simple fact: Each operation only increases the value by 1, so if we want to turn on the $$$i^{th}$$$ bit, then there is only one number that we'll reach first before others, i.e $$$2^i$$$ (pretend the higher order bits are zero). And also, there's just one strategy to go there, because $$$val + cost = 2^i$$$ implies that $$$cost = 2^i - val$$$.

      Since, any number can be represented as $$$\sum 2^{set\_bit\_index}$$$, we can clearly deduce the cost is $$$2^i - \sum 2^{set\_bit\_index}$$$

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

Problem D1: week test case submission case:

1 1
1

0

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

I try to solve D2 with Trie but failed, does this problem solvable with Trie?

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

Am I right in that the only thing that matters in E is $$$(s_x \oplus s_y) \mod 2$$$ and whether there is more ones or zeros among $$$(x_i \oplus y_i) \mod 2$$$? If so, I love the problem, but I hate what it did to my rating haha

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

I got stuck in problem E because my answer is choosing "First" while the testcase says "Second" and I'm trying to figure out what is wrong in my idea while it's all correct.

So I just want to say that the most most stupid thing you can do in a contest as a problem setter is to put a testcase in a problem and say that this is not the optimal solution in the description.

I don't have to read the description cool ... and I don't have to search in all the page for a fool note.

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

good contest

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

Great contest and nice problems ! Special thanks for problem E :)

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

You can do divide and conquer on queries in d2

Crucial observation is that if we add to a certain number to make bit B on, every bit below it turns to 0, which means for future steps, the adding calculation is straightforward. I call these numbers "stragglers".

The idea is that for bits > (highest possible bit of MAXAI), either we kill or don't kill all the bits. If we kill all the bits, every number is a straggler, so it becomes easy to calculate. Else, the array stays the same. So no extra memory needed at this step.

For bits <= (highest possible bit of MAXAI), we actually care about the array. If we don't kill all the bits at this step, we store A. If do, we need roughly sz(A)/2 elements in the worst case. At least it seems.

However, notice that although the array A is big, after we kill off the biggest bit, there are only sz(A)/2 possible values. So actually, yes, at each recursive step, we only need sz(A)/2 + sz(A)/2 = sz(A) memory, so after bit <= (highest possible bit of MAXAI) we only need MAXAIlog(MAXAI) memory total.

Queries can be updated naively because the depth of the recursive calls is log(K) and we split it up into disjoint intervals, so each query is only touched log(K) times

This is my thoughts after discussing w/ adamjamil after contest. In contest, I had such a scuffed impl since I sort of handwaved the argument above, leading to a lot of extra constant factors that weren't needed. But here is the final impl, is pretty fast :) submission

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

Looking at my graph I think I'm really a purple coder.

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

Problems were really high quality

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

Can somebody tell me why are samples in E not correct? I lost 20 minutes because of that, it is so stupid. There were few more technicalities that were so dumb. Overall, I liked the problems. Great round, better than last few.

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

Some individuals have mentioned encountering integer overflow issues with their D1 and D2. A helpful workaround involves utilizing a long double instead of an int64_t, as long double can manage cases like 1e25 or 1e1000. It's noteworthy that you can still compare a long double with an int64_t, and if the situation permits, the long double value remains equivalent to the int64_t value.

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

Greetings from Greece! The problems were interesting, congratulations.

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

After working through the problems (since I didn't solve any in-contest), here my thoughts:

A: nice easy problem (I misread as exactly K at first, and thought I was going to have to implement something more challenging)

B: a nice problem, perfectly fits the expected difficulty

C: really nice problem, 1 observation about how to rewrite the sum, then easy short code

D1: nice problem D (fairly standard though)

D2: hard for problem D, but a really good problem in my opinion

E: nice interactive problem, observation felt the same difficulty as C to me both E and C basically just involved rewriting some summation *slightly, and then implementing something relatively simple

F: another really nice problem in my opinion, perfect fit for it's difficulty I had trouble setting up the implications in contest, but after seeing some solution and learning a very clean way of doing it --particularly from ecnerwala's solution

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

My favourite problem : E