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

Salam, Codeforces! $$$\color{white}{\text{ «Be attentive about your thought that becomes your behavior» «Be attentive about your behavior that becomes your speech» «Be attentive about your speech because it becomes your habit»«Be attentive about your habit because it becomes your personality»«Be attentive about your personality because it becomes your destiny» Said by: Imam Ali}}$$$

We're so excited to invite you to take part in our round Harbour.Space Scholarship Contest 2023-2024 (Div. 1 + Div. 2) which will start on Aug/26/2023 17:35 (Moscow time). The round will be rated and open for everyone.

The problems were prepared and authored by amenotiomoi, Dhruvil Psychotic_D Kakadiya, Han wuhudsm Jinlong, Amir Hossein Amir_Parsa Farhadi, Matthew chromate00 Roh, JohnVictor, ODT, ugly2333, EternalJourney, RiverHamster, MagicalFlower and AquaMoon.

We would like to thank :

You will be given $$$9$$$ problems and $$$3$$$ hours to solve!

Score Distribution:

$$$500-1000-1250-1500-2000-2500-3000-3500-4250$$$

UPD1 : Editorial is out.

UPD2 :

First Solve

Problem Name
A qiuzx
B noimi
C SSRS_
D Um_nik
E Geothermal
F MysticPanda
G Radewoosh
H maroonrk
I Radewoosh, One and only Orz

Top Performers

Rank Name
1 Radewoosh
2 maroonrk
3 EvenImage
4 Benq
5 Um_nik
6 jiangly
7 SSRS_
8 noimi
9 hos.lyric
10 Brewess

GL & HF ;)

Sign up for the contest →

This round wouldn't have been possible without Harbour.Space University's support.

This contest is for all interested eligible programmers who want to start their bachelor and master studies in Barcelona, Spain or Bangkok, Thailand, and join ICPC team.

For the next academic year (2023/24), Harbour.Space University is recruiting a fascinating community of competitive programmers from the top prize-winners of international Olympiads to join one of several competitive programming teams at the university.

In the next few years, their goal is to continue winning SWERC and competing at a high level in the ICPC globally. Therefore they want to invest a serious amount of energy, resources, and talent into these activities.

That’s why you are invited on an exciting journey in the company of like-minded people, outstanding coaches, and ongoing partnership Harbour.Space University with Codeforces.

Over 100 educational rounds were already organized, so the time has come to test our joint efforts and reward the most diligent.

Here’s what you win if you place in the contest:

Codeforces and Harbour.Space

The monthly living allowance throughout the entire duration of studies may vary depending on the overall performance of the students as measured by their GPA, professional achievements and official ICPC competition results. As a guideline, it is in the range of 700-1500 EUR (it might be applied to the contestants who win 4th-10th places).

No application fee is required for any of the awards listed above.

Good luck, and may the code be with you!

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

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

Finally the first official round of TheForces, I am so happy at this moment and looking forward to your wonderful feedbacks and participation, Good luck!

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

This is my first time as an author. I hope you will enjoy the problems.

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

There is an inconsistency, Round says (Div 1 + 2), 9 problems and 3 hours whereas the scoring distribution is for a 7 problem split Div 1 and Div 2

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

It was my first time testing codeforces round, I am so happy!

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

Excited for your first round as an author my friend amenotiomoi :)

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

Welcome to the first official contest of theforces, hope you enjoy our problems (including my problems)! (≧ω≦)

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

As a problemsetter, I hope everyone enjoy the experience in the contest!

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

OMG Psychotic_D round!

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

As a Tester, I am here to comment :).

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

As a tester, I enjoyed the round and found some very nice problems! I recommend you to participate.

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

As a tester, I recommend all of you to participate in the contest. It's a classic one.

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

First time as a tester I recommend you to take part in this round!

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

TheForces to Codeforces... orz!

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

as a first time tester, the problems are very nice to do :]

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

As a non first time tester, the problems are quite nice and I hope you have fun solving them.

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

AquaMoon + TheForces contest , can't get better than this

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

As a tester, I wish you good luck and have fun solving these cool problems :)

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

First time as a tester! I hope you can enjoy these problems.

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

it's my first time being a tester ~ hope u enjoy the round

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

Orz ODT round!

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

As a first time tester, hope you all can have fun and also get positive delta.

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

As a tester i did not realize the blog has been posted xD

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

Are placements calculated from everyone who participated in the contest, or from those that applied for the university? As it says "Awards are distributed to those who are interested in pursuing..." in the picture, but the description says "if you place in the contest".

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

So many testers that none of the comments are participants

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

First time seeing score of any problem is 4250. Interesting to see who is able to solve it first

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

AkibAzmain bruh how were the problems ?

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

TheForces Orz

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

I got impressed by your creativity in indicating 'You' as legendary grandmaster colour( in last point of thanking ) .❤️

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

As a tester: the problems are cool!

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

Very good, I need to sleep well before the contest starts

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

If these turning epochs do not move with aw will today, the spheres of time are not constant do not grieve, Poem by Hafez Shirazi

Nice poem in the announcement :)

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

As a tester, I tested the round.

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

Hello Contest Organizers, I'm new to the platform and have never tried Div1 + Div2. Should I register ? Would this make my rating fall bad if I could only solve 1 or 2 problems?

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

As a first time Codeforces round tester, I'm pretty much sure that everyone will enjoy solving the problems.

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

is score related to rating range of a problem?

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

As a participant, I am writing this comment just to comment :)

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

Loved that you... That was precious... Few people know these things...

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

Thanks MikeMirzayanov for black testing

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

First time testing an official round.
The experience was awesome and I've learned a lot of things.
As a tester, I can say that the problems are really interesting. GL&HF
Congrats to TheForces for having their first official round!!!

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

220364168 what is wrong in it for 1779C - Least Prefix Sum

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

As a tester, the problem setters are not retarded.

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

I may be able to solve problem D this time.

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

"If these turning epochs do not move with aw will today, the spheres of time are not constant do not grieve, Poem by Ha"

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

All the best

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

Is it rated for codeforces rating??

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

TheForces Orz...

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

for all interested eligible programmers

Eligible for what?

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

Hope a good round! Hope I won't become expert today :(

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

Should I participate this contest to become pupil? Or even after solving question i will get negative delta?

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

VivaciousAubergine, for not testing.

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

It's been 8 months since my last (Div. 1 + Div. 2) Contest. I'm eager to reclaim my BLUE rating once more.

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

any 「Chtholly」? or at least one block-divide algorithm problem,right?XD

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

In my mind E is always a DP problem. Will it...?

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

9 problems & 3 hours! Amazing! Good luck!

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

Looking forward to solve 2 out of 9 problems.

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

I liked problem C.

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

Nice problemset. how to solve D i am thinking like a range for each one then crossing out the zeroes in that range ?

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

    greedy

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

    Iterate over rows from top to bottom. Notice for each 1 that remains in the current row, you are forced to use an operation.

    Thus, the idea is to loop over rows from top to bottom and count the number of ones. Then, you have to find a way to efficiently store the effects of the operations on future rows.

    This can be done by keeping track of the number of operations performed on each diagonal and using prefix sums for each row.

    My submission: 220552191

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

How can I get abdnp from this input? in Problem B

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

10 more minutes and I'd have E, :(

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

for B how to prove that even window = sort the whole string?

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

    If the window length is even then reversing the string will change parity of all values,thus each value can be positioned at any index(both odd and even) using two types of operations.

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

    Because of the first kind of operation you can sort all the odd indices and even indices separately. Now if the other kind of operation allows to swap characters at the end of an even window then you can use it to send any odd index element to even index. This allows us to sort the whole array.

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

      you can swap the parity of the indices with even k, but then you have to change the parity of k/2 odd,even pair at the same time. How do you get from this to sorting the whole string

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

        Suppose if you sort the whole string you know which characters are at odd and even indices in the final sorted string. Then you can use the second operation to change the parity of any character that is not in it's correct parity list and finally sort it using first operation.

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

    Assuming you got the part when window is odd. position 0, 2, 4 .. will be sorted position 1, 3, 5 .. will be sorted

    Now, you have arrived at this, then you can change the parity of any element with even window which again can be sorted with i, i+2 swapping,

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

    Think of it in this way, let's say you have $$$2$$$ components (graph) of even indexes and odd indexes. Reaching from one node to another means you can swap these $$$2$$$ indexes in the original string. Now if, $$$K$$$ is even that means you have an edge between the $$$2$$$ components of graph making it a single big component, while if $$$K$$$ is odd, parity of swapped indexes will not change, and they will still lie in the same component as their original one.

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

    .

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

    Let 1 represent a character than belongs at an odd position ($$$1, 3, 5,\dots$$$) in the sorted string and let 0 represent a character that belongs at an even position ($$$2, 4, 6,\dots$$$) in the sorted string.

    Lemma: If we can make the string 011010...10101 equal to 101010...10101, we can always sort the original string.

    Proof:

    Construction:

    Start by moving the incorrectly placed 0 (first character) as far back as possible. Now our string is 111010...10100.

    Now, reverse the first $$$k$$$ characters. Now our string is [0101...010111]10...10100 ([] contains the reversed part).

    How many incorrectly placed ones 0's our string currently have? Before the operaiton, we had one such 0. Every 0 included in the reversed segment was good, so now they're all bad. The reversed segment included $$$k/2$$$ elements at an even position, one of which was a 1 and the remaining $$$k/2-1$$$ were 0's. These now became bad, so we have a total of $$$k/2$$$ bad 0's.

    Note about above statement:

    Now, we have $$$k/2$$$ incorrectly placed 0's. Thus, we also must have $$$k/2$$$ incorrectly placed 1's. We can move all of these to the first $$$k$$$ positions of the string and reverse that segment, making all of these good. This concludes the proof that it is always possible to do the operation required for the lemma, which proves that the string can always be sorted. $$$\square$$$

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

    Let A be the minimal set of odd index values we would like to be even, and B be the minimal set of even index values we would like to be odd.

    Clearly |A| = |B|

    By induction, we only need to decrease the size of these sets.

    Place some value of A at index k-1, and some value of B at index k

    Preforming the window operations [0, k-1] and [1, k] will only change the parity of the values at index k-1, and index k.

    So the order of |A| and |B| decrease.

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

Loved Problem D AquaMoon, E was also good but i couldn't implement in time.

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

As a small point of feedback, I wouldn't use $$$(x, y)$$$ to refer to row $$$x$$$ and column $$$y$$$, the $$$x$$$-axis is usually horizontal / $$$y$$$-axis is usually vertical. Maybe use $$$(r, c)$$$ instead. Otherwise thank you for the contest!

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

What is the pretest #3 of problem G?

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

I like the contest for today D is so good i liked it so much C i got it too late , i was thinking of number theory soultion but it was bitmask

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

Nice contest, thx!!!

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

thanks to authors for the great round, simple problem statements and interesting problems

Plus a,b,c,d were very balanced. Slight sudden difficulty jump at e-but obviously nobody can optimise all the problems to be perfectly balanced.

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

I figured out how to do D when it was about more than 1 hour left, but couldn't implement it...

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

Expecting the solutions~

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

submitted E 9 seconds before the end but it showed contest is over. i will have a huge negative delta, if E is correct then i don't know what i will do.. i'm crying right now

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

Any hints to solve D? I tried 2D Fenwick Tree, but it gave TLE.

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

Good contest overall. Thanks for this round! :)

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

C is sooo brilliant!! And how everyone is genius can be seen from the number of acceptances of C and E!

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

What is the intended solution for F? My approach was for a query [L,R] first check if L==R if yes then only one operation is needed otherwise we need to bring all element in range [L+1,R] to L and then use one operation to reduce all to 0 but it gave WA on pretest 5. Submission: 220592550

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

GapForces

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

why still not start pending

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

I would like to know which problem is made by ODT

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

seeing the submission count of c question i think brains have evolved

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

I solved C and submit it and it got passed but I thought it could be give Integer overflow therefore I again submit the solution later and my score got decreased why? :(

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

I loved problem E, thank authors for the good contest!

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

someone could give me a code with B?

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

C>>D

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

As someone who is not good at math, I found Problem C much more difficult than Problem D. I spent too much time on Problem C and didn't pay attention to Problem D. That was a lesson learned.

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

Nice round, thank you!

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

Beautiful problems. It's been a while i've seen problems like these. Though i think C and D could be swaped.

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

Was the 1000 used as the upper bound in Problem C deceptive or is there any solution intended?

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

Can anyone explain how to solve E ?

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

    Let's understand how to count the number of turns for A and B. Alice looks for the first 1 in A|B (suppose its position is i). If A[i] == 0, she understands, that B[i] == 1, so A < B. Otherwise she can't say anything exact, because B[i] can be either 0 or 1, so she skips. Now it's Bob's turn. If B[i] == 0, he understands, that A[i] == 1 and A > B. Otherwise he looks for the next 1 in A|B and the situation repeats. In general, let's define C as the number of 1's in LCP of A and B. If C is even, the answer is C + 1, otherwise C + 2 (corner case A == B, the answer is always C + 1)

    How to count the answer for the problem? We can iterate k = [1, n] and choose A = a[k]. We can use trie to count for each prefix of A the number of B's, such that current prefix is LCP for A and B (suppose this number is P). Then we should add (P × number of turns) / (n × n) to the answer.

    My submission: 220583318

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

    Consider the positions of the 1s in the OR value. When I refer to position, I am talking about these specific positions with 1 in the OR, skipping all the positions with 0 in the OR.

    If Alice has a 0 in the first position, she knows the 1 came from Bob, so her value must be smaller, allowing her to end the game. Otherwise, if she has a 1, she doesn't know whether Bob has a 0 or 1 here (or about later positions, if any), so she answers "I don't know".

    When Alice answers "I don't know" on her first turn, then Bob knows Alice has a 1 in the first position. Now, if Bob has a 0 in either the first or second position, then he knows his number is smaller, and ends the game. But if he has a 1 in his second position, then he answers "I don't know".

    More generally, if both players have 1s in the first $$$k - 1$$$ positions, then the first $$$k - 1$$$ turns are all "I don't know".

    Side Note: If Alice and Bob first differ at the $$$k$$$-th position, then the $$$k$$$-th answer depends on whether the person who is answering has a 1 ("I don't know") or 0 (smaller) in this position. So there are either $$$k$$$ turns or $$$k + 1$$$ turns, depending on who got the smaller value. This might sound annoying, but it's actually easy to handle when we deal with it later.

    So how do we count the expected number of turns? We can first count the total number of turns for every possible pair. But there are $$$n^2$$$ pairs, so we cannot afford to consider each pair one by one. We need a more efficient way to count them.

    My approach for calculating these turncounts involves MSD-RadixSort. We separate numbers based on whether their first bit is 0 or 1, then for each group, we separate them further based on the second bit and so on. At the $$$d$$$-th level, given a group, their first $$$(d - 1)$$$ bits all match and we can keep track of how many 1s are there to get the value of $$$k$$$. Then, if an unordered pair is formed by any number who has a 0 in the considered digit position and any number who has a 1 in the considered digit position, this will result in a turncount of $$$k$$$ or $$$k + 1$$$. Since we actually need to count ordered pairs, we add both $$$k$$$ and $$$k + 1$$$ to our total turncount (one corresponds to whether Alice gets the 0 and the other to whether Bob gets the 0, but we don't care which is which, and this keeps changing when $$$k$$$ updates anyway), i.e., multiply the number of unordered pairs with $$$2k + 1$$$.

    Finally, we need to consider the base-case, when we have a group where all values are equal. The MSD-RadixSort stops here, but it is possible for Alice and Bob to get the same value, which would also be equal to the OR value. If this OR value has a total of $$$k$$$ 1s, then there will be exactly $$$k$$$ turns of "I don't know" and then on the $$$(k + 1)$$$-th turn, the player will realize there are no positions left, and that they both must have the same value. The number of ordered pairs is equal to the size of the group squared (recall that both players might get the same index), and the turncount is exactly $$$k + 1$$$. The case where one or both players get the number 0 is correctly handled here (no need for an exceptional edge case check).

    Finally, don't forget to keep spamming the mod operation and to perform modulo division of the calculated total over $$$n^2$$$ (total number of ordered pairs) to get the final expected value.

    My submission: 220592883 (may have to wait until System Testing is done to see it)

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

I think problem D is boring and easier then D from other contests.

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

I think E >> F.

Both Alice and Bob are smart enough.

It's quite hard to be as smart as Alice and Bob LOL.

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

Very unfortunate to have spent an hour writing a brute force solution to E and then 40 minutes looking at a computer screen. But the contest was good.

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

Can anyone Explain How in E if a = 2 and b = 3 number of turns are 3.Like first alice think a|b = 3 so b can be 1 or 3 ,then turn will shift to Other person ,he thinks a might be 3 or 2 or 1 ,what ahead?

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

    Third turn: Alice knows that b = 1 or 3.

    If b = 1, then Bob would know that a = 2 or 3, leading to b < a, which stops at second turn.

    So Alice knows that b = 3, then she knows a < b, which stops at third turn.

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

For problem D, I implemented a O(n^3) solution by greedily selecting '1' in row major order and updating subsequent rows using prefix sum array structure. How to solve in O(n^2)?

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

    I did some sort of lazy propagation: updating only the next row, but keeping the information (that this update needs to be propagated further).

    My solution (in Golang): 220584229

    This changes the time complexity to (n^2).

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

    Instead of updating prefix sum array in each row, memorize where should the increment + decrement in the array should happen if you were to construct the prefix sum array at current row. To be specific you can maintain two counter for each column index, specifying how many increment and decrement should happen in each square. Then, whenever going down a row, the increment counter would shift left by one square, and the decrement position would shift right. You can then use this information to construct that prefix sum array in O(n) for each row, and update the counter in O(n) whenever going down a row

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

    Same as above, but using C++: 220587779

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

Can someone give a solution for C?

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

.

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

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

Why I change my code a little and submit again,then get skipped?

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

Am I the only person who got mad at problem A because the input order was $$$x, y, n$$$ rather than $$$n, x, y$$$?

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

How does subtraction of divisor relate to turning off lowest significant bits? How does it even ensure that we never repeat any divisor of subtraction twice ?

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

    I couldn't solve it, but this is pretty interesting. It is not that hard, just think about it.

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

      I went about it like this:

      If n = 2^k then we can at every step subtract it by n/2 to finally reach 1 using every number exactly once. Eg: 8->4->2->1

      Now suppose the highest set bit in the binary representation of n is k. Then we know that we can reach 1 from 2^k. Now how to reach 2^k from n? At each step we turn off the LSB of n from it till it reaches 2^k since the number formed by the LSB always divides the number and using this operation we use each number only once.

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

    Our construction will consist of two phases; we will show that each divisor is used at most once per stage.

    Let $$$x$$$ be our current value, and let $$$k$$$ be the largest integer such that $$$2^k \mid x$$$ ($$$a \mid b$$$ means $$$a$$$ divides $$$b$$$, i.e. $$$a$$$ is a factor of $$$b$$$). If $$$x = 2^k$$$, we move onto the second phase. If $$$2^k \neq x$$$, then $$$x = 2^k \cdot q$$$ for some integer $$$q \gt 1$$$. $$$q$$$ must be odd; otherwise $$$2^{k+1}$$$ would divide $$$x$$$ and $$$k$$$ wouldn't be the largest such integer. If we choose $$$d = 2^k$$$ and replace $$$x$$$ with $$$x - d$$$, we get

    $$$x_\text{new} = x - d = 2^k \cdot q - 2^k$$$

    $$$x_\text{new} = 2^k(q - 1)$$$

    Because $$$q$$$ was odd, $$$q-1$$$ must be even. Thus, the largest $$$k_\text{new}$$$ such that $$$2^{k_\text{new}} \mid x_\text{new}$$$ is at least $$$k + 1$$$, so we won't repeat the divisors during the first phase.

    In the second phase, we have $$$x = 2^k$$$ for some integer $$$k$$$. While $$$x \gt 1$$$, we can keep choosing $$$d = 2^{k-1}$$$ and replacing $$$x$$$ with $$$x - 2^{k-1} = 2^k - 2^{k-1} = 2^{k-1}$$$. Thus, we won't repeat any divisors in the second phase and we will use each divisor at most twice, which is enough to solve the problem. $$$\square$$$

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

    I used the concept of meet in the middle. Suppose x is 39, I define the 'middle' as the biggest power of 2 less than or equal to x. In this case, the 'middle' is 2^5 = 32.

    From 1 to 32: 1 -> 2 -> 4 -> 8 -> 16 -> 32 (Each jump is using a different number)

    From 39 to 32: 39 -> 38 -> 36 -> 32 (This has to do with the lowest significant bit.) (Each jump is using a different number)

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

I have a completely different solution for problem C.

For a given value of $$$n$$$, I assume that there is a solution only considering divisors of the form $$$\frac{n}{p}$$$, where $$$p$$$ is any prime that divides $$$n$$$.

Given that it’s not obvious which $$$p$$$ we should use in each step, I literally try every possible value with backtracking, keeping track of the amount of times I used each divisor with a map (to avoid using them more than two times). As soon as I found a solution, I stop.

Note that in each step of the recursion, I factorize $$$n$$$ in $$$\mathcal{O}(\sqrt{n})$$$ to get all possible values of $$$p$$$.

I have no idea why this solution works, and also why it’s fast enough.

Here is my submission: Link :)

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

How to do B?

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

Why am I still in queue...

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

Problem E teaches us all that when someone says "Mine is bigger than yours", this person is likely not intelligent and cannot be trusted to speak honestly.

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

Video Editorial For problem A,B,C,D.

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

Really liked the problem C. Unfortunately couldn't solve it during contest...

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

Great contest; felt like authors actually cared about the + Div.2 part of Div.1 + Div.2. Thanks guys!

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

Hey, why was my first solution for A skipped?

I submitted it after 11 minutes and it should be correct. My second submission was after 2h52m and got accepted but it gets 200 points less.

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

Does anyone know why this submission TLEs for F on test 49 with C++20, but the same one passes comfortably with C++17?

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

Could anyone that knows python give me explanation why the time differ so much in problem E? I use Trie to solve problem E.

During my contest, In the submission 220592727

class Trienode(object):
    def __init__(self):
        self.count = 0
        self.child = [None,None]

It gives me TLE many and many times, and cause me lose big rating. Then after the contest, when I read other's solution, make the submission:220607127), only change the node structure to:

class Trienode(object):
    def __init__(self):
        self.count = 0
        self.left = None
        self.right = None

It passed within 2 seconds. Why they are making so big difference?

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

Radewoosh congrats with winning scholarship in Harbour.Space!

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

All the problems I did were great, this is honestly one of the best rounds I've competed in. I solved A-D and almost solved E in the last 5 minutes but forgot to mod n^2 before calculating the mod inverse :(

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

The memory limit of E may be a little small because...

A poor guy is hacked!

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

In problem b, how this test : cdba will be abcd with k=4

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

One of best contests ever thx guys

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

Happy that I solved first 3 problems in this contest , but could have solve little faster to get good rank.

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

I really like problem C. Thanks.

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

Nice Contest

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

Plag check going on ? After these many weeks Ratings are rolled back deyumn.

I got -1 when I was at 1599 Rating, now I hope I get +1 to 1600 and become Expert :)

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

Incorrect plagiarism in Question D: The approach to the question used by many people is quite similar due to the structure of the question: just 3 DP matrices, and because of this, the structure of the code of a lot of the submissions is similar. Please look into this.

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

nice contest