Perhaps today and/or tomorrow due to a power outage there may be disruptions in the work of Codeforces and Polygon. Please do not plan any important events during this time. If there are details or the exact time, we will definitely publish them. Estimated time of maintenance: from 2 Aug, 16:00 (UTC) to 2 Aug, 20:00 (UTC). ×

By Harbour.Space, 13 days ago, translation, In English

Codeforces and Harbour.Space

Hey, Codeforces!

We have great news for you.

Harbour.Space University is excited to announce a new contest for all interested programmers who want to start their studies in Barcelona, Spain or Bangkok, Thailand, and join our ICPC team.

The contest will be hosted on the Codeforces platform Jul/22/2021 17:35 (Moscow time). We have prepared 9 problems of the joined (Div1 + Div2) level. The round will be rated and open for everyone.

UPD: Scoring distribution: 250-500-750-1250-1750-2500-3000-3750-5250

UPD2: The editorial is out!

Sign up for the contest →

For the next academic year (2021/22), we are recruiting a fascinating community of competitive programmers from the top prize-winners of international Olympiads to join one of our competitive programming teams at the university.

In the next few years, our goal is to win SWERC and compete at a high level in the ICPC globally. Therefore we want to invest a serious amount of our energy, resources, and talent into these activities.

That’s why we are inviting you on an exciting journey in the company of like-minded people, outstanding coaches, and our ongoing partnership with Codeforces.

We have already organized over 100 educational rounds, so we think 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 depends on the overall performance of the candidate. As a guidance, it is in the range of 500-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.

We would like to say a word of appreciation to:

UPD3: Congratulations to the award winners!

Note1: All the winners get an application fee waiver.
Note2: All of you eligible for Competitive Programming Scholarships (cf rating > 2000) may apply directly through our website and go through the general admissions process.

Guaranteed full scholarship + monthly living allowance + free 3-week course:
- 1 (49). Ali.Kh
- 2 (58). Yousef_Salama
- 3 (175). Krauze

A full scholarship with interview process + free 3-week course:
- 4 (184). sunyx
- 5 (200). 777
- 6 (203). Redhood
- 7 (219). Meijer
- 8 (226). Gioto
- 9 (265). kpw29
- 10 (267). Huah2

Free 3-week course:
- 11 (292). dhruvsomani
- 12 (299). adamant
- 13 (326). Kaitokid
- 14 (355). khiro
- 15 (264). c8kbf

Good luck, and may the code be with you!

Harbour.Space University

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

»
13 days ago, # |
Rev. 5   Vote: I like it -113 Vote: I do not like it

Sir Errichto is an Author, seems Good!

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

    Can i ask why so many downvotes?

    please don't downvote this message :((

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

      because people think that downvotes are better than upvotes :(

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

        My rating is 1351. If i wanna become a specialist after this round, (to gain 50 rating points) 4000th place will be enough, right? (giving the fact that all div1 participants (about 1200 users) will be above me)

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

      people downvote everything, just like stack overflow ahah, anyway dont take it personal

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

      Get a higher rating and you'll get upvote — CF hidden laws No.1 -

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

        Yes, get higher rating and stop writing stupid comments and you will get upvoted.

»
13 days ago, # |
Rev. 2   Vote: I like it -32 Vote: I do not like it

Only 3 testers? Kinda weird O_o

UPD: LostCoder was right, more testers were added

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

    only if they were grey

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

    Probably new testers would be added in few more hours i think.

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

    tourist prepared the last contest all himself. So, i think 3 testers isn't too bad

  • »
    »
    12 days ago, # ^ |
    Rev. 2   Vote: I like it +17 Vote: I do not like it

    Now there are 1015 testers.

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

Niceeeeee prizes, but absolutely they're not mine :(

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

Erricto means we r getting Geometry Problems. change my mind!

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

Errichto is one of the authors = good round

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

Weird terms of agreement when registering for the contest:

Section#38:RegistrationTerms

Maybe it makes sense to fix this? So that the cheaters don't have a formal "I didn't break any rules" excuse.

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

Albeit really appreciative for the CF partnership, I highly doubt this recruitment strategy will be particularly effective. Limiting the choices to only top 10 in div 1 just seems absurd and suicidal. Unless it was never intended for the prizes to be collected?

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

    I understand that it's top-10 among those showing interest.

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

      Yes, that would make way more sense. I misinterpreted it.

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

rules are broken again

»
13 days ago, # |
  Vote: I like it +40 Vote: I do not like it
benefits summary:
»
13 days ago, # |
  Vote: I like it +68 Vote: I do not like it

Screenshot-2021-07-20-212653

My only achievement at codeforces

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

    And my only achievement is gone now, thanks to my new friends :(

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

      It's not gone, you have been given a new target, chase it up ;)

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

    Meanwhile me:

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

      you are guys? i thought you are computers with legs :D

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

    I looked at my contribution and my fans' number and didn't feel like saying anything :(

  • »
    »
    11 days ago, # ^ |
    Rev. 4   Vote: I like it +113 Vote: I do not like it

    wait should i be happy or sad lol

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

      Woah!!! Behold, Here comes the true legend

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

      Every action has equal and opposite reaction? Btw, nice coincidence! (/◕ヮ◕)/

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

As a tester, I want to wish you all good luck & high rating!

P.S. Yes, it is rated.

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

Praying for specialist! Also orz to the authors, the testers, and MikeMirzayanov for the Platform!

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

As a tester, I ...

»
12 days ago, # |
Rev. 3   Vote: I like it -65 Vote: I do not like it

.

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

Is it possible to decline the scholarship(not that i'll win it, just curious)

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

Hope to reach pupil. Should i solve previous contests of these authors? Would that be helpful?

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

Hoping to be an expert for the first time in this round. Got stuck around 1500-1600 for too long.

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

The moment i see Errichto name in the author list, i immediately checked the contributors list and then realised that he is not the author of the announcement blog :(

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

Really very excited to participate!!

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

Looking forward to it! interested in your university. i ma still a bit young but i have plenty of time to practise for your future contests!

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

When, will the scoring distribution be announced ?

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

curious to know how did authors from different nations came together to write a round? As far as I know, CF coordinators don't accept individual problems

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

Hope I can become an International Master after this round.

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

    Sad.I could become an International Master if My D were not FST.

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

i just wanna congratulate tourist, benq and radewoosh for getting the first three places and winning the scholarship

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

Is it a 3 hour round?

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

Score distribution??

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

It's been a while since I entered a contest after a time skip, I'm looking forward to it <3

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

The purpose of the scholarship is to attract the top-ranked coders to join the university and to win ICPC, right? So, if they don't fulfill the requirement for ICPC (e.g. age limitation), does it mean they are not eligible for the scholarship?

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

    Good day, foolishgoat We carefully take a look at each case separately. Winning the ICPC is one of the priorities of our university, but also, we are investing in a community of like-minded competitive programmers. We have had the cases of several top-rated programmers who have been already awarded scholarships for one of our technical master's programmes

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

update: 9 problems in 2h 30m :)

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

I think this round will have best problem ever I have seen.

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

Score distribution?

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

UPD: Scoring distribution: 250-500-750-1250-1750-2500-3000-3750-5250

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

250 points for A... First time am I seeing that!

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

I have never seen 250 pts for problem A. It will be interesting!

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

tourist ans Benq both are participating today and the fight for rank 1 continues!

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

Speedforces coming up

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

So glad to see marX as a problemsetter!

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

Amazing!!Contest

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

getting 5min long queue for 1st question :(

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

stringforces

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

Does someone ever had this feeling, that you didn't register for the contest and thought you will after you solve till C (pupil goal), and then realize you can't register anymore (for the first time)? (sad emoji). Anyways will upload in practice.

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

    why did you have to use so much tactics??That you didn't register then waited until solving C.Just fucking register before the contest and give the contest like a winner.Don't be so timid!!

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

      For The First Time. Also, Regarding the tactics everyone should have there own Freedom of choice.

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

        of course you have the freedom of choice,I just gave my opinion(nothing else)

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

      saying a person who stopped giving contest after becoming specialist once.Show the same courage yourself if you think you can sustain specialist by giving contest.

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

        It's a dumb comment from you.How do you know that I am not giving contests because of fear of loosing specialist position??I am very confident that the next contest I will give I will be expert.Besides,I don't consider being specialist as an achievement.For me it's just a node on the path.

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

          A kid who took 71 contest to be specialist once is confident to be expert in his next contest.Just stop lying to yourself bro.

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

            and people like you can only comment like these...I don't care whatever you say.3 years later when I will become red after giving 200 more contests..Please on that day comment some stupid stuffs too..I am inviting you.Till then take care and stop barking

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

          I am very confident that the next contest I will give I will be expert..

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

At least i will be able to participate in div 3 round.....

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

HackForces

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

Saw a tough Fight between Tourist and BenQ...Congrats BenQ for winning.

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

I trolled on F because of a one char error for like 40 minutes -_- but the problems were good overall.

The observation on E was pretty nice (albeit maybe a bit convoluted?).

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

What is the intended solution for F? I am doing like some $$$O(n \log MAX ( \log MAX + \sqrt{MAX} ))$$$ shit and runtime is ~3950ms. Likely not going to pass sys test.

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

    I had a solution with the same complexity, but couldn't debug in time :/

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

    If you use sqrt decomposition with prefix/suffix sums in each block then the $$$log$$$ factor disappears because the intervals are disjoint.

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

    I was able to do $$$O(n\sqrt{n})$$$

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

    I used Fenwick trees to compute the sum and count of numbers $$$\ge \sqrt{K}$$$, with $$$K=500$$$ it passed systests in 888 ms.

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

How to solve E?

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

    Why my E does not work?

    Foreach p[i] we calculate the k if that p[i] was an unswapped one. Then we collect the frequency of all those k.

    Each k with a freq>=n-2*m is a possible k.

    But that fails on pretest 2, why?

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

      Nope, you still need to do further check. Try this input:

      1
      6 2
      2 3 4 1 5 6
      

      Your code outputs 2 0 5, but this is incorrect. Can you change 2 3 4 1 5 6 to 1 2 3 4 5 6 with only two swap operations? You can't; you need at least three.

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

    At most 3 different shift values are possible. Check each of them (we run dfs and check if the number of bad-ordered vertices — number of cycles <= m).

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

    There are at most 3 possible k's (you only consider k's where we have >= n-2*m fixed points, you couldn't move more), and m <= n/3.

    For each k, just check how many swaps you need to sort it.

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

      I will always remember to read special constraints...

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

      I feel like I'm missing something obvious, but how does having atleast n/3 fixed points imply that only 3 k's can satisfy that constraint ?

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

        Using swaps you can change at most $$$2m$$$ positions. That means that each valid k has to have at least $$$n-2m$$$ fixed points. This is smallest when $$$m$$$ is maximal, which is $$$n/3$$$. That means you have to have more than at least $$$n-2\cdot n/3 = n/3$$$ fixed points, which is possible for at most 3 different k's.

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

          Thanks. I got to the "we need n/3 fixed points" criteria but could not come to the conclusion that it means we can have atmost 3 K's.

          The rather simple piece I was overlooking was that each position can only be fixed by a unique 'k'. So the set of fixed points for any two K's do not intersect and therefore having 3 of them have sets of size >= n/3 means there's nothing left for the rest of the Ks.

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

Holy,shit!C was easier than B.I didn't notice.

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

Is problem E related to counting inversions? I think I was close to the idea but couldn't implement it on time xd.

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

How to solve B??

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

Too bad problem B had such weak pretests. :(

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

Thank you for the contest!
Also, I'm glad to see a contest with hacks, for a change.

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

    Thank you for the contest!
    Also, I'm glad to see a contest with weak pretests, for a change.

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

E was such a troll problem.

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

    Why so ? . I just want to know why do you think it is . I wasn't able to solve it,Can you explain your solution ?

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

      The basic idea is that for each k, you perform the shift, and then you count the number of swaps needed to go from one permutation to the other. If it is at most m, we found a good k.

      But this solution takes quadratic time. The key insight is the constraint on m <= n/3. This means that we only need to consider options where at least n/3 numbers are already fixed. And there can be at most 3 of these.

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

Please check why it is giving runtime error for Problem-D :- 123349910

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

Find my D is wrong and resubmit in the last minute!!!!!

Case

And hope my F will pass although it takes 3.96s in pretests

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

what is the hack testcase for B?

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

How to solve D?

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

Scoring distribution: 250-**1900(500+14×100)**-750-1250-1750-2500-3000-3750-5250.

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

    What testcase did you use for hack?

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

    You still missed 4 hacks in your room lol

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

    I did my best in hacks too :)

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

    I thought there was a B test case that I was missing after only hacking 1 B solution in my room and seeing others hack 5+ B solutions, but after system testing I see that others were simply way more lucky with the rooms they were in.

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

Can someone please help why my solution of B giving wrong answer, got stuck for 1.5 hours:(

link

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

I solved A,C. Solved C first time in codeforces. Thanks for the contest.

»
11 days ago, # |
Rev. 4   Vote: I like it -48 Vote: I do not like it

Hello! Why does this solution for C is failing on the second pretest? I was debbuging it for like two hours, but my debug method has a fatal flaw -- i'm brainlet. Pls help. https://pastebin.com/xqysHjZu

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

    Test with 1010101010. Your code outputs 7, but the correct answer is 6.

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

      This is interesting, thanks for the observation, 'll try to figure out, i guess...

»
11 days ago, # |
Rev. 2   Vote: I like it +14 Vote: I do not like it
Observation for E
  • »
    »
    11 days ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks for sharing your observation...!

    I thought about it for hours, but couldn't get it :(

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

What is Test3 in problem F

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

Pretests for D are very weak.

Test case for successful hacking

And my pretest passed solution also fails on this test case and I realized that after hacking someone else solution and locking my own T_T.

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

Problem B & D weak pretest :(

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

i think standings is gonna change very much :/

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

I've got a really nice new achievement in this contest. Which is I'm the first participant to get WA on test 23 on Problem E, and almost the only, actually there are just two participants who managed to do that. Thanks codeforces for this new achievement.

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

How to solve F? I think I figured out how to calculate all pairs apart from ones with structure (i < j a[j] % a[i]).

  • »
    »
    11 days ago, # ^ |
    Rev. 4   Vote: I like it +5 Vote: I do not like it

    Add numbers from left to right. When we insert a number $$$a$$$:

    1. $$$b \mod a = b$$$ for all numbers $$$b < a$$$, so add sum of all smaller numbers to answer.
    2. $$$a \mod c = a$$$ for all numbers $$$c > a$$$, so add $$$a$$$ to the answer multiplied by the amount of larger numbers.

    The other 2 cases are a little more difficult

    1. In order to count $$$c \mod a$$$ for numbers $$$c > a$$$, lets notice that $$$c \mod a = c - i \cdot a$$$ for numbers $$$c$$$ in range $$$[a \cdot i, a \cdot (i + 1) - 1]$$$. Just loop over $$$i$$$ and count using the formula. Total iterations over $$$i$$$ for all values will not exceed $$$A \cdot log(A)$$$ (similarly to Sieve of Eratosthenes), because all of the elements are distinct.

    2. In order to count $$$a \mod b$$$ for numbers $$$b < a$$$, we do similarly to above, but instead we precalculate for $$$b$$$. So we do something like add $$$b$$$ to position $$$b$$$, add $$$b$$$ to position $$$b \cdot 2$$$ and so on... Then for $$$a$$$ we will add to the answer the number of smaller elements $$$\times$$$ $$$a$$$ — sum on range $$$[1, a]$$$.

    We can perform all the operations fast using some fenwick trees.

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

unbalanced contest + weak pretests, lmfao.

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

tourist was happily securing second place ... And then the hackers came :)

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

123348935 Problem D Why this gives WA on pretest 17?

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

Hacks on problem D should be a lesson to future problemsetters that you should either have more than 1 brain cell or use $$$t \leq 10^4$$$.

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

    What do you mean?

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

      You can either make all possible test cases with small $$$n$$$ and a small alphabet size(2, 3 or 4) or do the brainless approach of using $$$t=10^4$$$ and making completely random test cases by partitioning $$$1.25 \cdot 10^5$$$ into $$$10^4$$$ parts and making the size of each part the size of the first string for that test case, making the alphabet size a random number between $$$1$$$ and $$$min(n,26)$$$ and making the size of the second string a random number between $$$1$$$ and $$$n$$$. Both of those will definitely make a test case like ab a, which is the only D hack that I know of.

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

        Well, setting $$$t \leq 10^4$$$ is something different than setting higher $$$t$$$ and just making a few random tests, but I guess the "more than 1 brain cell" part is kind of about it.

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

    Bruh, all pretests on D except 2 (and sample test) have $$$t=1$$$. These 2 pretests have $$$t=10$$$ and $$$t=500$$$ respectively.

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

How to solve E?

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

Suppose someone hacked any solution. My question is will that test case be included in system test?? Or it remains the same?

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

f**k the sh*t weak pretest

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

FST Forces!!! T_T

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

its not a good idea to start doing problems after 1 and half hours of contest beginning, I got it after I could not solve atleast 2 question

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

Is this real? Red coders getting FST on B?????

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

It seems hacker also get hacked :3

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

Good job on making an Educational Hackforces Round!

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

    Yeah...too much Goof problems

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

    yeah i can feel the same pain..

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

    Cool.. Educational Round is rated for Div. 1 now, meanwhile AtCoder Regular Contest isn’t for some reason.

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

In B, except for the edge cases, not getting covered in system tests. There is also another hack case.

The system tests don't include even a single case of "YES" with sz(s) == 500 and sz(t) == 999, because there are solutions (which got AC'ed), with dp array parameters as 505, 505. (dp[505][505]).

:(

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

Why not $$$10$$$ tasks of "write a cycle"-style?

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

    I was wondering for a while. Did you mean "loop"?

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

      I was wondering for loop a while loop. Did you mean "loop"?

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

Man, what is going on, my submissions are not being checked

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

Your text to link here... I want to know that why problem B is always routime error

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

    I think the line "int i=s.length()-2" is the reason for getting runtime error. s.length() always returns an unsigned integer. If the value of s.length() is 1 then s.length()-2 will not be -1. It will be a big unsigned integer and your string doesn't have that big size. That's why you got runtime error.

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

Hi Everyone, what is the correct approach for problem D, I was trying to greedily find the next matching characters but it's not the correct approach. Do we need to think around dp for this question?

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

    I also use greedy and get the right answer

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

    Do greedy on the reversed strings and you will succeed. To prove it: let's say that in the correct solution we do not match a pair of symbols and do backspace instead. Then after some even number of symbols, we will face the same symbol. We could have just deleted all the skipped symbols + this one and just pick the very first one we faced. Thus, our greedy works.

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

      Sir, thank you for hacking my B, only if you could've done it a little earlier :(

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

some people were hacked in the middle of the contest and they were able to resubmit? i dont see this fair but ok..

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

    Yeah, It seems unfair because getting hacked is just telling somebody that your solution will fail system tests .Obviously he/she will resubmit and escape FST .

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

      yeah but that allows you to find the mistake and submit a good solution which will pass. and what is FST?

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

Is B the problem with the most FST in cf history ?

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

The pretest are f*ck*ng weak.

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

With the help of Problem D,I can't get Grand Master!

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

I would worry about losing rating, but fortunately div.3 rounds are unrated for me.

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

Thanks for the strong pretests!!!!!!!!!!

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

A meme:

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

B & D

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

Currently I am new here started few months ago and did few problems of Div 1.

should I solve 100 problems of Div 1 or I should solve 30-40 and then proceed to Div2

I did the below problem B

But I got late to submit

Can anybody suggest if this is a good approach or a lengthy one

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

    Did anybody explain you not to insert code directly in the comment?

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

    Why do I get So much downvote though I already wrote that I am newbie, you code masters treat a newbie this way to encourage them

    • »
      »
      »
      11 days ago, # ^ |
        Vote: I like it +4 Vote: I do not like it
      1. This blog is about the certain contest, so people only discuss about that contest. Avoid discussing about other stuff.

      2. There are many other people who have asked the same questions. Do some searching online.

      3. People's experiences are different. No one can tell you the single best way to learn.

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

I have a question but I might get downvoted,

What is the importance of pretests if they don't tell me if my solution is correct or not?

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

So I spent more than 1.5 hours on F and after reading some accepted solutions, I realized that I overlooked the "distinct" part. Please press F guys.

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

    But I think there is only a slight difference if written cleanly(which I wasn't able to do so).

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

    WTF I literally just found that I had overlooked it because of your comment.

    F

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

    :O I didn't read that too and just hoped my $$$\mathcal{O}(N*(N/B)*log(N/B))$$$ works lol

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

    Me too! I had a lot of trouble with fitting my $$$O(N * \sqrt {N * \log (N)})$$$ solution in the TL, but eventually I did try deleting the #define int long long line, which helped a lot. Will reconsider using it in the future.

»
11 days ago, # |
Rev. 4   Vote: I like it -25 Vote: I do not like it

.

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

Woops I didn't realize we had to end an even number of positions away from the end in problem D so I tried both parity sequences, muh bad.

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

why my submissions are not getting judged?

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

Don't forget to check my submissions. My all submissions are still in the queue. :(

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

Does the $$$==$$$ operator on strings return "false" immediately if the lengths are different? I assumed that it doesn't and tried to hack a guy which would have $$$O(n^4)$$$, but it was unsuccessful.

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

Damn! Hackforces :/

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

![ ](image)

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

    same...I was going to gain 93 rating (and reach expert!), but then after system tests, I'm going to lose 7 rating.

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

My F passed with 3.993s. Wow.

(Probably the redemption of last round's F)

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

Can someone point out the edge-case of B, though I passed FST, would like to know what it was?

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

      And why should not be "YES" ? "cabac" = "cab" + "ac" ? right?

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

        Yes, output should be "YES" but my code printed "NO".

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

          Don't Worry! My code printed "YES", still failed system test :)

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

.

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

    maybe he solved F quickly and just thought of having a look at D and then forgot to submit F coz he thought let me solve this D quickly coz it's gonna be quick and then he submitted both of them together.

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

hackforces going great :3

why soooo weak pretest!! :'(

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

I think that it's the most fstforces round on cf

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

What does FST mean?

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

TLE on 87th test case :( .

Habour poor test case.

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

This contest told me never locked the problem if you don't want to hack others. I knew why i was wrong when I was hacked by others, but I cannot make any submission anymore.

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

score prediction after contest +69

score prediction after system test -69

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

 (on test 18)

such a big difference between system-testing on B vs E

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

This was my first ever contest , can anyone help me how can I improve, how to practice and study ?

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

lesson learnt, never participating in any harbor space contest again.

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

This was my first contest and I have solved one question but my profile showing still unrated anyone can tell reason for it?

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

Announce this round as unrated for too many controversy.

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

how is cabad cabac correct in problem B: Reverse String?

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

You have been warned.

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

    Looks like a strong testcase for problem D.

    1
    <<the blog text>>
    weakpretests
    
»
11 days ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Does anybody know what was the problem in test 19 problem D?

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

    That's a large test case, I don't know. But looking at your solution, what you're missing probably is that the position at which $$$t$$$ ends must be at even parity relative to the end of $$$s$$$.

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

Thanks for the contest! It was nice. Really enjoyed solving it!

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

What is wrong in this approach with problem D : every two adjacent letters in t should have even distance between them in s. so the path is even odd even odd ...... or odd even odd even odd even.

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

    there is no or. There is a single possibility. D was solvable by a single for. It was honestly ridiculous for a D.

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

      It's a combined round, not ridiculous. In most Div1 + Div2 A-E is solvable by pretty much anyone >= 1700 rating, it's mostly based on observations.

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

    take the index of the last character that you choose, call it p

    the number of characters from p + 1 to the rest of the string has to be even

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

So the solution to D which checks if $$$t$$$ is a subsequence of $$$s$$$ fails on the second testcase in the sample test and then on test $$$17$$$ if anybody is interested.

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

I feel that D could have been worded better. "If you type the string s and press backspace instead of typing several characters of s."

This made it seem like using at least one backspace was compulsory.

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

Why do I get So much downvote though I already wrote that I am newbie, you code masters treat a newbie this way to encourage them

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

Can Anyone please explain Why This Solution is giving TLE when being run on GNUC++17(64) compiler and is getting accepted on being run on GNUC++17 Compiler only Link To Accepted Submission

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

Poor contest. G is trash, don't understand why it is approved.

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

    That and bad pretests on B and D. D was literally 10 lines of code that were basically nearly guessable as logic by pupils that hardly have any experience with such contests. B was probably in the end harder than C or D. Also, that left quite a big difference in difficulty between D and E.

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

      There wasn't a gap between D and E
      In fact, if you look at number of solvers and the fact that E is after D, E is barely more difficult at all

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

    I'm curious--why do you dislike G? I think the weak pretests in this round are problematic, but I enjoyed solving G. The main observation (that the answer is at most two) was fairly nice and well-motivated, and my eventual solution was relatively concise. The authors could perhaps have done more to make the round as a whole less focused on speed and on avoiding FSTs, but I thought this problem itself was a fun one to solve.

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

      Quite straight forward, the idea is trivial, I can solve immediately after reading it.

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

    I agree that G is simple and one can come up with a solution in a few minutes (which is bad if you then need to code for 10-15 minutes). That wasn't the case for many testers and organizers though. The number of ACs confirms that the difficulty was fine.

    Even though I was very involved in preparing this problem, I think it's the worst one out of E-I. EFHI are good problems.

    Also, I think that this contest would be much more enjoyable for div1 without the first few problems. I stated many times that combined rounds are bad. What about using just D-I or E-I, maybe with problem G replaced with something more interesting.

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

      Combined rounds are bad but contests with prizes can't be split into divisions.

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

Wrote a recursive solution for D, but got run time error on pretest 4, pretty sure it is recursion limit exceeded error. Here is the solution if anybody is interested: https://codeforces.com/contest/1553/submission/123341608

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

To not keep you waiting, the ratings are updated preliminarily. In a few hours/days, I will remove cheaters and update the ratings again!

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

If cf-predictor is correct, We will see Benq on top replacing tourist.

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

say hello to weak pretests on D

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

what's TC 19 in problem D ?