pashka's blog

By pashka, history, 6 weeks ago, translation, In English

Hello! On Jan/15/2024 17:35 (Moscow time) will start Codeforces Round 920 (Div. 3), the next Codeforces round for the third division.

The round was coordinated by Vladosiya, and prepared by me and the students of Neapolis University Pafos: Vitaly503, goncharovmike, ikrpprppp, step_by_step.

Thank you very much Alexdat2000, dan_dolmatov, fastmath, FBI, Nickir, nikhil97agra, pavlekn, PMiguelez, SashaT9, senjougaharin, Sergey140146659, Sparrow_Guo, Toy_mouse, vladmart for testing the round.

As usual for the third division rounds:

  • there will be 6-8 tasks in a round
  • round duration is 2 hours 15 minutes
  • the round follows the ICPC rules, penalty for an incorrect submission is 10 minutes
  • round is rated for participants with ratings up to 1600
  • after the round there will be a 12-hour open hacking phase

Remember that only the trusted participants of the third division will be included in the official standings table. As it is written by link, this is a compulsory measure for combating unsporting behaviour. To qualify as a trusted participant of the third division, you must:

  • take part in at least five rated rounds (and solve at least one problem in each of them)
  • do not have a point of 1900 or higher in the rating.

Regardless of whether you are a trusted participant of the third division or not, if your rating is less than 1600, then the round will be rated for you.

Good luck to all!

UPD: Editorial

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

»
6 weeks ago, # |
  Vote: I like it +47 Vote: I do not like it

Can't wait to pass 1500

»
6 weeks ago, # |
  Vote: I like it +14 Vote: I do not like it

Wow! Translation into Russian

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

Good news!

»
6 weeks ago, # |
  Vote: I like it -17 Vote: I do not like it

As a tester, I fucked up during previous contests because I was poisoned( but I wont give up and will restore my CM status.

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

    As a participant i am at a loss how this information is relevant to this contest

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      As a good person, I just wish you all best in the upcoming round

»
6 weeks ago, # |
Rev. 3   Vote: I like it +4 Vote: I do not like it

Am I right that round was rescheduled from 16th of January ? If so, its very unusual. For me I was planning to take part and made some effort to free 2 hours on Jan 16, but tomorrow it will be impossible... Or I just had a glitch about 16 ? )

»
6 weeks ago, # |
Rev. 2   Vote: I like it +23 Vote: I do not like it

Yet another post-contest discussion stream Upd: I have updated the link. Sorry for issues in the begining.

»
6 weeks ago, # |
  Vote: I like it +8 Vote: I do not like it

Finally my turn to write this...

My first unrated div 3

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

I hope to reach pupil rank one day :).

»
6 weeks ago, # |
  Vote: I like it -7 Vote: I do not like it

hoping for +ve delta in this round.

»
6 weeks ago, # |
Rev. 2   Vote: I like it -16 Vote: I do not like it

This comment has been deleted.

»
6 weeks ago, # |
  Vote: I like it -12 Vote: I do not like it

My first unrated div 3

»
6 weeks ago, # |
  Vote: I like it -9 Vote: I do not like it

i wish get 1400

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

Good morning pashka <3

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

In the points it is written rated upto 1600 and then in the last it is written less than 1600.. which is true?

»
6 weeks ago, # |
  Vote: I like it +33 Vote: I do not like it

I usually skip div3 these days, but I'll do this one just because of pashka :)

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

    Me too ^_~

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    but "do not have a point of 1900 or higher in the rating."

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You can alwayes participate as unofficial participant

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        with a rating higher then 1600 you can't register(I think)

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

          I have already registered and participated, and there are alot of div1 people doing the same thing (the only diffrence is it's unrated for us)

          The top10 in scoreboard during the contest had only 2 people that have rating less than 1600 and the most of the others are reds

»
6 weeks ago, # |
  Vote: I like it +38 Vote: I do not like it

Please restart your youtube channel with some new series, pashka orz

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

Any way to lower by rating by 12 ?

»
6 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

the round will be good if pashka prepared it)

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

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

Bunch of handsome peoples

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

wow pashka here, I thought that we face a lot of interesting and educational problem

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

My first contest here :)

Got a question: a "penalty for an incorrect submission is 10 minutes" means that there is a timer and it takes 10 minutes away (so the round is 1h 5m for me), OR does it mean that I'm just banned from submitting code for the next 10 minutes, but I still have the same remaining time for solving problems.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You get points like you submitted it 10 minutes later.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    No, that's not what they meant. You should be aware that if you got a accepted after(for example) two failed submission and someone got it from the first time (consider that both of u solved it at same time) he will get penalty less than u .Also,He rank higher than you.

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

If I have registered for the round but I do not enter the contest, will my rating get affected?

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

As non-tester i confirm this is the first Div.3 after new year!

»
6 weeks ago, # |
  Vote: I like it +9 Vote: I do not like it

Hopefully, the problem's statement will be short, precise, and easy to understand!

»
6 weeks ago, # |
  Vote: I like it +5 Vote: I do not like it

My first unrated Div 3.

And pashka as one of the setters , can already confirm it's going to be an awesome coding contest!

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

anxiety

»
6 weeks ago, # |
  Vote: I like it +12 Vote: I do not like it

Amazing round I love U all <3<3<3<3

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

As I write this round, I can say with confidence that it was a great round that I enjoyed.

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

with all due respect, problem C is just kind of shit.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Bruh, you solved upto F but couldn't solve C :/

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      If there's no problem C, it's easy for me to solve all the problems. I can't understand the problem, maybe I'm poor in English.

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

    Why? Because of the problem’s statement? I don't see any problems and it's a good problem.

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Maybe the problem is hard to understand for a Chinese English speaker. I spent almost 60mins to try to understand it but failed.

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

time to attempt the first question only to get it wrong on pretest 2 and ragequit (my rating still gonna go up lmao)

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    i had the same thing, try virtual contests, they bring less stress gl

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    your profile picture reminded me of Sam Hogan. Good old days

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

      it is sam hogan we will never the days he actually posted sadly he disappeared but tbh i don't know why anyone would want to leave such a successfully channel

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Game development can be exhausting. Brackeys and Dani have also not uploaded anything for quite some time.

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

          Brackeys left and im pretty sure Dani also quit also sam went off to college but yeah game dev is just generally like that

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

How to solve E ?

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

    nvm, looks like it's just checking all the cases. I thought it's some classic algorithm.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You can check out my solution for e, it's just maths :)

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

is F solvable using Mo's?

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

    You can just precompute prefix sums for d <= sqrt(n), and for d > sqrt(n) just brute force the answer. In the first case a query takes O(1) and in the second case its O(sqrt(n)). Preprocessing takes O(n sqrt(n)).

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I thought about prefix sum for small d as well but not yet implemented, tks for the clear solution!

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I thought of precomputing the prefix sums but just not for d <= sqrt(n), I was thinking of every d <n. Is sqrt(n) common in these type of problems? Why do we select that as the cutoff?

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        it's very common indeed. U can read this for more detail

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Because memory is limited and if $$$d > sqrt(n)$$$ then it's easier to just iterate instead of precomputing for every element.

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

        Imagine , if you take d as a cut-off , then final complexity will be n*d + q*n/d = n(d + q/d) , which will be minimised at d = sqrt(q).

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

        sqrt(n) observation not necessary. you can do offline query method. for all the queries put the s%d,d in some set. now for only these (start,difference) you need to precompute and this would be somewhat n*(q)^(1/2) Submission

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      ah that's really clever

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Basic idea is precomputing answers for all d <= $$$\sqrt{N}$$$, which can be done by prefix sums in O(N*$$$\sqrt{N}$$$). For d > $$$\sqrt{N}$$$, simply iterate and get your answer.

»
6 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Nice contest. F and diagonal prefixes in G are tricky, nice problems for educational rounds.

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

nice round especially providing many sample test cases thank you

»
6 weeks ago, # |
  Vote: I like it -9 Vote: I do not like it

Exposing cheating case please make the contest unrated the solutions were live streamed on the following channel

https://www.youtube.com/live/q5YxSQlknAQ?si=rM_nl9XokelPGkJF

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

    why have it unrated for all, just the cheaters should be eliminated

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

Got Stucked in Problem E.

»
6 weeks ago, # |
  Vote: I like it +4 Vote: I do not like it

Thousands of cheaters in this round. saw some noob coders solving DE faster than specialists. hoping they will get filtered out for fair rating update

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

In problem E what do they mean by if both opponents play optimally , do we have to check every possible move from current position, and move only in those direction in which player is winning?? i am not able to understand this problem please explain. Thanks!!

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

    play optimally means that if there is a winnig state for player A, then player A will play in such a way that will win.

    No need to check every possible move if you find a general case for wich A wins

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

Nice contest

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

I can't see myself in the standings. I have participated in 5 rounds and have solved at least 1 problem in each.

  • Round 919
  • Good Bye 2023
  • Round 916
  • Round 915
  • Round 914
»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I tried to come up with a one-line formula for B, but this approach gives WA in the 3rd test:

max(((s & f) ^ s).count(), ((s & f) ^ f).count())

Does anyone have any idea what I might be missing here?

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

    #define bin bitset<64>

    Your bitsets only store $$$64$$$ bits, not enough for $$$10^5$$$ bits.

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Oh my, haha! I got used to putting 64 bits everywhere and being sure it works for any input. I completely forgot I'm dealing with a bitset, not an integer or anything else.

      Thank you. It's accepted now! <3

»
6 weeks ago, # |
  Vote: I like it +3 Vote: I do not like it

mind solved f in 10 minutes, could not debug my code in contest with more than an hour left. then debugged within 5 minutes after the contest!!!!!

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    can you explain your approach for the problem F ?

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

      2 cases case 1: when d>sqrt(n) in this case you can just brute force each query because will take O(sqrt(n)) time because if d>sqrt(n) there will be no more than O(sqrt(n)) elements to choose from i.e., k cannot be greater than O(sqrt(n))

      case 2: when d<=sqrt(n)

      for each element in i store prefix sums and for each d and also store increasing prefix sums (1*arr[i], 2*arr[i].. like this) then solve in O(1) per query.

      i did not explain case 2 very clearly i am finding it very hard to explain.

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

        got it , thanks

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

        for case 2 I'll explain how to solve when d=1

        given an array a, answer queries of given [l,r) find S = a[l]*1+a[l+1]*2+...+a[r-1]*(r-l)

        define sum[l..r) = a[l]+a[l+1]+...+a[r-1] = pref_sum[r] — pref_sum[l]

        notice S = sum[l..r) + sum[l+1..r) + .. + sum[r-1..r) = (r-l)*pref_sum[r] — pref_sum[l] — pref_sum[l+1]-...-pref_sum[r-1]

        so we can do a second prefix sum array over our original prefix sum array

        • »
          »
          »
          »
          »
          4 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          how to get the answer from second prefix sum array when d>1?

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

        i did not explain case 2 very clearly i am finding it very hard to explain.

        I seriously think this is the reason why you couldn't debug your code within an hour. It may make sense to explain your solution to yourself until you understand all the details completely before implementing it

        • »
          »
          »
          »
          »
          6 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Or understand during the implementation. Sometimes it's nice to write down something to free up some space for understanding missing bits.

          ps. Congrats with impressive performance in the round.

        • »
          »
          »
          »
          »
          6 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          ya i think so to, i jumped into implementation too soon.

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

I don't know why, but I do very well outside the contests but when I participate I feel stupid, I didn't even solve D.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Same lol :)

    I kept tripping over the math for B and C.

    Then for D, I was thinking it was a heap/priority queue solution, but I couldn't figure it out.

    Was hoping to make Pupil this round, but oh well :_(

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

      D has really counterintuitive solution.

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I partially agree. I first decided E, and then I figured out that in D you need to put 2 pointers to the array A, not one :D

        (This is KillerQueen from tg)

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    just need to participate in as many contests as you can

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      well you are wrong here is why.... but jokes asides its like you tell someone to play more blitz games to get better at chess

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        uhm but it's not about getting better at something what he/she is asking, it's about getting used to something so you can overcome nerves

        • »
          »
          »
          »
          »
          6 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          well if that what u mean u got a point then sorry but thats how i interpreted your comment sorry again :)

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I found that D is extremely likely to be fakesolved for me. I cannot find the bug since my code pass all examples and got WA on test 2.

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I don't think so man, I passed all example cases through different approaches but two of them were wrong and then the third one finally got me AC.

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

Another fun round for a newbie like me :) Please somebody should try to hack my solutions

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

I am an amateur I have just solved one problem I just want to ask can I have some score? I hope I will have 1200 through this vacation's effort Can someone explain to me how can I get some score

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    With 1 solve and your default expected performance being 1400 you should expect a huge drop in rating. However since you're unrated, there's a +500 bonus on the first round, so your rating will still increase.

    You would need to wait for the system test to end, which would happen about 18 hours from now, since there is open hacking phase.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Do continue practice. It will improve your problem solving skills and logic building skills. I am also a amateur coder .But now i taking it seriously I was able to solve two problems. Earlier i was not able solve any problem. But with continuous practice i have some improve skills

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

Such a nice contest! really liked the F. overall quality was great and the contest was balanced , 10/10 honestly.

»
6 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

how to solve F and G??

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

    F can be solved in O((n+q)*sqrt(n)) , by dividing in two cases d <= sqrt(n) {for which you can use suffix sums) and d > sqrt(n) for which just sum directly. However , I believe taking d <= sqrt(q) , will be more better.

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

Too many cases in E, solved just after contest ended :(

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

    you can just simulate it !

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

      constraints are large. can't simulate it.

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

        "It is guaranteed that the sum of $$$h$$$ over all test cases does not exceed $$$10^6$$$."

        • »
          »
          »
          »
          »
          6 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          sorry my bad, didn't see. I just saw the constraints of w and assumed h to be similar :(

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        I think it can be simulated as the sum of h over all testcases is guaranteed to not exceed 1e6

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Just few cases :

        if d = vertical distance between them is odd or even ,

        If d is odd then Alice will Eat B or B will escape ,

        If d i seven then Bob will Eat Alice or Alice will escape.

        Escape condition needs max right you can go and max left you can go, if by going to any extrema ( left or right ) , if you are able to escape the Eater, then draw or else lose.

        Link to code

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Single if is enough to compare two intervals where two players could meet.

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

Naisu contest, I felt climaxed by the AC in the final seconds =))

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

can someone give me clean implementation of F?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Maybe this can help

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

    My solution (241838398) precalculated prefix sum of a[i] and prefix sum of a[i]*i, for all $$$d\leq\sqrt{n}$$$. It's $$$O(n^{3/2})$$$ time and $$$O(n^{3/2})$$$ space, which seems to just fit the time and memory limit.

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

How to solve G?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Make diagonal prefix sums, like 2d prefix sum and try each of 4 possible directions in O(1) for n*m shooting squares.

    I failed to implement it in time

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

    Bruteforce every possible starting location. To move the starting position by one cell you need to add/remove subsegments of a row, column, or diagonal. From here it's down to your implementation skills.

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

    There is a simple solution in $$$O(nm*min(n,m))$$$.

    Assume WLOG $$$n \le m$$$, The solution is: iterate over every $$$(i,j)$$$ as the start location, iterate over every row $$$x$$$ that the $$$(i,j)$$$ will reach with the operation, find the sum of the elements of the row that is in the range of the operation with simple prefix sum.

    This work in O(n^2 m), if $$$m < n$$$, just rotate the input. This is code: submission

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Oh, I thought this will TLE, but min(n,m) can be at most sqrt(1e5), which idk why, I missed :(

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

    I had a slightly different solution:

    Solve the problem for the down/right diagonal only. Rotate the grid four times and print the best answer over each rotation.

    To solve for the down/right diagonal, notice that a shot from point (r, c) of size k is equivalent to a shot from point (0, 0) of size k + r + c, minus the combined number of targets in the first r-1 rows of that shot and the number of targets in the first c-1 columns of that shot. This can be found using inclusion/exclusion and prefix sums.

    So, we can enumerate the targets in order of their Manhattan distance from (0, 0) and check starting points for the shot using a sliding window technique.

»
6 weeks ago, # |
  Vote: I like it +28 Vote: I do not like it

Problem D  In some test cases, t is 10000 (which is not correct)

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

    Yes, we will fix it and rejudge all affected submissions.

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

      Done. We changed the tests so they have at most 100 testcases. It affected a very small number of participants. They got AC instead of TL or WA.

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it
Spoiler

Can anyone tell me why my solution of D is giving me wrong answer on test case 3

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Perhaps overflow?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Also, vector erase method is $$$O(n)$$$, so your code is $$$O(n^2)$$$ which doesn't fit the time limit. Instead, try to use a pointer int L = 0, and increment it to simulate erasing the first position.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You are using erase, I did the same and got tle. Either use a dequeue or two pointers.

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

Good Round

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

Hi, Can somebody explain why this Code for Problem D gives Runtime Error 241826844.

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    prefa[0] = a[0];
        for(int i=1;i<m;i++){
            prefa[i] = prefa[i-1] + a[i];
        }
    

    this segment will cause Index Out of Bounds for Array "a"

»
6 weeks ago, # |
Rev. 2   Vote: I like it +5 Vote: I do not like it

Nice F, btw this is the worst E i have ever seen in div 3

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

F-ed Up big time. Submitted E just after the contest ended and got Accepted on the first attempt. FML :').

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

Can today's D be solved by binary search?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    my approach was to club max elements of A with min elements of B and Max elements of B with min elements of A.

    And there will always exist an index i before with we'll club max elements of B with min elements of A and after index i we'll club max elements of A with min elements B

    I brute forced it. It gave tle on tc7

    Now i want to ask that if this can be optimized using BS. BS to find that optimal index i?

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Binary search is only applicable for monotonic functions, in this case, the function isn't monotonous. So binary search won't work

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Brute forcing like that is how I did it, you can optimize by using prefix sums to calculate the answer for each cut-off point in O(1).

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

        why didn't i think of that T_T

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

I have solved all the problems except the last one. I am willing to discuss the solutions with you. If you need help for the hints or solution idea, you can knock me.

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

Just curious, is D solvable using ternary search?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    my thought process included noticing the ternary searchable array. But since we're trying to maximise the answer, optimal points will be on either left or right ends.Therefore no need to do ternary search. just have to check ends

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

How many problems I need to solve in Div3 as a pupil, to reach specialist ? Can someone tell ?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Want to know the same

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      i think solving 4 fast is pretty good to reach specialist. In some cases if E is easy then solve that too.

      (take advice with grain of salt I am newbie)

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I did some calculations and i figured that if u managed to solve A and B in div 2 under 15 min u might reach specialist without ever solving C or rarely solving it. Similarly solving 4 in 45 to 50 min will get you to specialist through div 3.

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

Can anyone tell me what the time complexity of my code(Problem G) is? 241841658

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

In F, I am trying to solve this question O(n*root(n)) but it is giving me TLE. I saw many people did it in O(n*root(n)). can anybody help me to find out where I am going wrong? My submission: [241845077]

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

    Yeah, your solution is O(n*root(n)), but your index in vector is [arr_index][step]. If you know, vector stored continuously in memory. When you refer to [ind1][step] you need calculate offset to [ind1][0]. If say simply, need to calculate [0].size() + [1].size() + [ind1-1].size() and it's not effective. But if you start iterate by first index and after by second index it's more faster, because your elements in memory was close. You can turn your vector and get accepted 241873500. Or you can use matrix, because program know size of every lines. 241875600

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

Hi, I am new to codeforces. I submitted a code 10 minutes before the contest ended and it was accepted after 3 failed attempts , why is it still showing as unrated for me? And when will I get it get rated for me. Someone plz reply

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

    Div.3 and Div.4 usually take up to 24 hours after the end of the contest before ratings are published.

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

Hello everyone. For D i used the 2 pointer approach to solve it. Basically sorting both the array then checking for each term in nth size array which difference is the maximum. Depending on the term chosen, the pointer moves and rechecks.

You can see my submission. I have gotten a test case where the solution fails. But i am not sure what is wrong with my approach. One of my friends used the same approach but deque and got the correct result. Any help would be appreciated.

»
6 weeks ago, # |
  Vote: I like it +24 Vote: I do not like it

Who else say E and thought: "oh yeah this is like opposition in chess endgames"

lol

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

My D's solution got WA on tc2 when submitted during contest. After System test it got AC. Now after System test again it got WA on tc24 .

What's the issue here? I meant on CF site, why did it happen?

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

关机不耗电

»
6 weeks ago, # |
Rev. 2   Vote: I like it -31 Vote: I do not like it

241860369

Problem E.

Easy to understand one liner solution C++.

»
6 weeks ago, # |
Rev. 5   Vote: I like it 0 Vote: I do not like it

take part in at least five rated rounds (and solve at least one problem in each of them)

Hi, does this apply to all Div.3 contests? thanks

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

I love this round from A-F(I didn't read G), except for E.

»
6 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

How much time will it take for the ranks to be updated?

Hope I reach pupil :)

And also can anyone explain what are 'hacks'?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    • The rating update process typically takes approximately 1 to 24 hours.
    • Hacks refer to a method where contestants can view each other's solutions for a given question. Assuming a solution passes all test cases, hacking involves suggesting a test case that would cause the solution to fail. In Division 3, there are no rewards for hacks, and the hacking period lasts for 12 hours after the contest concludes. In Division 1-2, participants receive points for successful hacks, and they must actively hack other solutions during the contest.
  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Hacking means finding bugs/testcases in other people's solutions that make the code fail.

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

Overall, Another fun round for me :)

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

when the ratings will get upated?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    it will take approx 24hrs

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks buddy and my rating drop eventhough I didn't gave wrong answer and I solved 1 question though the same

»
6 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

When will you release the editorial?

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

when will the rating change happen?

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

When will the ratings for this round be updated

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    within 24 hrs after contest.

    Can you say how many problems have to be solved in div3 to become pupil?

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Bro got no chill to become a pupil.

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        how many did u solve?

        • »
          »
          »
          »
          »
          6 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          I did 4 questions. D was hard for me.

          • »
            »
            »
            »
            »
            »
            6 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it

            I did 3, I considered two pointer for D, implemented it also and it was not giving correct answer for tc1.So left it.

            after the contest i came to know that there was some issue with my implementation though the approach was right. T_T

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

Has system testing finished??

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yeah. System Testing takes less than 30min after the hacking period concludes. You can go to "contests" in the navigation bar and see the final standings.

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Nooo

      • »
        »
        »
        »
        6 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Sorry. I was wrong. This is what I found- "It takes a while (can be a few hours, or even more) to finalize things such as detecting cheats and confirming test results, or there can be other issues that need investigation"

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

Why is the rating for this round not updated yet?

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

Ratings?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Ratings take up to 24 hours to update in div 3 and div4. Also in a contest that has an official 12 hour hacking phase the rating will never be updated before it ends.

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

Can't wait to become PUPIL

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

A,B failed in system tests... :)

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

thank you for making me green

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

Please, help me to understand problem )

This submission gives TL on test #12: 241773908
If I change only language (java 17 instead of java 8), the same solution gets AC: 241948448

I can't understand, why the same solution gets TL and AC on different java versions?

Thanks

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I think the problem here is that sorting in Java 8 has $$$O(n^2)$$$ worst case time complexity. They fixed it in later versions

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it -10 Vote: I do not like it

      Thank you. Next time I'll better choose java 17 :)

»
6 weeks ago, # |
Rev. 4   Vote: I like it +2 Vote: I do not like it

This round Problem F have nearly same idea with recent atcoder abc contest 335 problem F. Problem link : https://atcoder.jp/contests/abc335/tasks/abc335_f

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

When will the results be declared?

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

F Video editorial + Live Coding C++ (English): https://youtu.be/mJVq_nW8iQk

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

why my rating got reduced by 30+ points even though I did no wrong submission just only one submission I did why on the earth soes this hpnd?

  • »
    »
    6 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    You did one task and in the result you got 20596th place, which is lower than "expected" for your rating. Also note that wrong submissions don't affect your rating directly, only the score obtained during the competition, which translates into your place in the standings.

    more info

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Problem D is 1100 rated 😱 😱