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

Автор glebustim, 2 года назад, По-русски

Привет, Codeforces!

Мы с SomethingNew рады пригласить вас на Codeforces Round 814 (Div. 1) и Codeforces Round 814 (Div. 2), которые пройдут во 16.08.2022 17:35 (Московское время). У обоих дивизионов будет по 6 задач и 2 часа на их решение.

Мы хотим выразить благодарность:

Разбалловка:

Div. 2: 500 — 1000 — 1250 — (1250 — 1000) — 2500 — 2500

Div. 1: (500 — 500) — 1250 — 1250 — 2250 — 2250 — 2750

Мы надеемся, что вам понравится решать наши задачи!

Разбор

Поздравляем победителей!

Div. 2:

  1. billieeyelash
  2. randboy
  3. TasselFlower
  4. AVRush
  5. Shiroqwq_

Div. 1:

  1. tourist
  2. maroonrk
  3. Petr
  4. ksun48
  5. Radewoosh
  • Проголосовать: нравится
  • +250
  • Проголосовать: не нравится

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

As an author, I authored this round.

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

Hope I won't participate in another Speedforces round.

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

Is this round, a speedforces round?

»
2 года назад, # |
  Проголосовать: нравится -32 Проголосовать: не нравится

I hope the questions are very difficult, so that I can show my strength. Ordinary div2 questions are too easy, and I type too slowly to get high scores. I hope it is more difficult!

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

Is there going to be some limitation with regards to rating? I'm a newbie can I still participate?

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

    Everyone can participate in every contest. The only issue is that if your rating is too high, your rating will not be affected by participating in lower-difficulty (higher Division number) contests. But since you're grey, your rating will be affected by all contests. In fact, if your performance is better than what is expected of your low newbie rating, you will very likely have your rating increased. I highly recommend participating in ALL contests.

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

Respect for ilaburkov

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

Hope . I'll reach pupil this time.

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

I hope i can reach pupil,in sah allah

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

i hope , i can reach pupil in sah allah

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

i hope , i can reach pupil

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

I WANT TO REACH MAAAAAAAAASTER!!!!!!!!!

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

Why do I feel that this announcement is quite shorter than others? In my impression the announcement of a contest is usually one screen long. (curious)

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

Really hope there is gonna be nothing wrong with this contest

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

Request to Authors : Please write editorial with hints and write hints themselves divided like Hint1, Hint2....

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

Request for Authors: Please write the editorial with hints.

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

Hope, I will get SomethingNew from this contest.

After Contest
»
2 года назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

As a tester, i think that it will be a little bit hard round, but still, problems are great and not viscous

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

Hope to achieve a satisfactory result in this competition

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

Hope to get specialist back (again)

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

I hope to get expert on this round!!!

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

Hope I'll reach Expert after this round.

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

i feel this round will be special <3

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

Hope I will see SomethingNew in this contest on my IP address 127.0.0.1 and won't be having glebustim to solve a problem that would have a memory limit of 1024mb.

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

Problem D in Div2 and Problem A in Div1 both have subtasks so does this mean that Div1A=Div2D? Will this Div1 be harder than usual?

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

    Either that or an extremely easy one, I'm hoping for the latter to allow me to get close to 2100 mark again after AK in Div2. :D

    I don't think sharing true info would be fair though, as some participants may opt to do/skip round if the answer favors them.

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

    Yes, Div1 A is Div2 D. We think that this will make our round more balanced.

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

as a tester, I tested this round

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

As a tester, I tested this round. Good luck everyone :)

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

тяночку бы

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

Edit: I was wrong D:

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

Is this contest became unrated??

»
2 года назад, # |
  Проголосовать: нравится -19 Проголосовать: не нравится

Hope to solve D this time :D

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

This will be my first div 1 Wish me good luck!

»
2 года назад, # |
  Проголосовать: нравится -16 Проголосовать: не нравится

Hope to get pupil on this round ಥ_ಥ

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

Interesting scoring distribution observation: In Div 2, the second part of the split problem is easier than the first part, but in Div 1, they’re apparently equally difficult…

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

    I'm quite sure the Div2D = Div1A exactly. I doubt there is much to be gleaned from the discrepancy in how the scores are distributed. The Hard version is treated like a Div1A problem (which oranges/reds should be able to solve), with the Easy version being worth exactly half. But for Div2 participants, it's treated as a D problem, which isn't as accessible, especially since ABC would take up some time at first, so it's a little harder to achieve the Hard solution for this Div2D. I guess that may justify giving it slightly more score than the Easy version in Div2, despite being identical to Div1A, and I don't think anything could be inferred by the relative difficulty of the two subtasks beyond the estimate that they're roughly equal.

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

Make me closer to red, plz.

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

A1,A2 ?! Really rare!Hope that the round will be nice to everyone. :)

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

Only 50 points left to reach specialist. Wish us good luck!

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

As an coder, we will code this round.

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

All The Best EveryOne !!!

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

Kindly remove the candidate masters from div 2 registered participants.

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

Why Burenka and Tonya? Where are Alice and Bob?༼ つ ◕_◕ ༽つ

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

Descriptions are there to help participants understand, not to prevent them from understanding.

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

Praise to Allah for the fact that I did not participate in the competition, if I participated in this contest, I, like many, would not be able to solve the problem C.

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

speedforces, penaltyforces, gapforces.

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

How to solve D1 and D2?

Also what's solution to B? I did some case work which is probably not intended.

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

    Problem B: For k%2==1, just take (1,2), (3,4)... (n-1,n) For k%4==2 again take (1,2), (3,4).... ,but for pair (i,i+1) if (i+1)%4==0, take (i,i+1) else take (i+1,i) For k%4==2 there is no solution

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

    Detail B solution is: look at n%4 and k%4. Then look at pairs mod 4: for example n%4==0, so numbers%4= 1, 2, 3, 0, 1, 2, 3, 0. If k=0 its impossible, k=1: a=3, b=1 and a=2, b=0 — 2 pairs. (so 1st pair a%4=4-k%4, second pair b%4=0)

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

    First of all, lets do k %= 4. If k == 0 there is no answer, idk why.

    You can solve this problem from each group of 4 independently:

    1000 2

    • 2 1
    • 3 4
    • 6 5
    • 7 8
    • 10 9
    • 11 12

    And so on...

    Now just some case-work for each k value

    Btw, i got B 10 seconds before contest ended (01:59:50 Pretests passed [pretests])

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

    I didn't have time to implement it, but I think D1 can be done using 2D DP.

    The key observation is that there is never any benefit to selecting a range of more than 2 elements, since the time taken for a block of size k + 2 is the same as the time taken for doing the block of k and the block of 2 separately. So to zero out an element whose current value is $$$v$$$, you would have to XOR it with $$$v$$$, but you can also choose to drag the next element to be XOR'd with $$$v$$$ (without costing additional time). There is no point in considering a longer range for this XOR.

    For an array of size $$$n$$$, consider the last element. You can either zero out the first $$$n - 1$$$ elements (DP) and then zero out the last element by itself, OR you can zero out the first $$$k$$$ elements, and then start an XOR chain from the $$$k + 1$$$-th element, where each element becomes 0 while XORing its next element as well. Depending on where you start the chain, the residue at the end varies, so you can check all possible values of $$$k$$$ to determine which of these XOR chains will zero out the last element and then choose the one with the shortest time.

    This takes $$$O(n^2)$$$ time, so it obviously wouldn't work with D2, for which I have no clue whatsoever.

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

      the trick is to maintain all possible residue values in a set, and then use it if it lets u merge the next guy with the next block.

      You can do this maintain by having a set and an additional "change" value that is supposed to modify all the elements of the set. To xor everything in the set, u just xor the change value, and to insert/query x, you insert/query x^change instead.

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

        Doesn't the set get really really big?

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

          u do it iteratively, like u only zero out the current block, and then consider pushing it one further (which adds/changes the residues). and if u can use a residue to merge a single guy with the next block u use it. So set only grows to O(n)

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

      Tried this, TLEd

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

        Hmm, I just submitted this approach right now and it was accepted (only 124ms): https://mirror.codeforces.com/contest/1719/submission/168605232

        I checked your submission, but I'm not too familiar with Java. However, it doesn't seem like you're actually a building a 2D array/table of the resulting XOR residues? So I'm guessing that you might be calculating the result of the XOR chain every time, which would yield a worst-case complexity of $$$O(n^3)$$$ (need to calculate the best time at a linear number of endpoints, each endpoint considering a linear number of XOR chains, with each XOR chain being computed in linear time).

        But if you maintained a table of the residues from each starting point (can be 1D, now that I think about it), then it should reduce to $$$O(n^2)$$$, which should definitely pass.

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

          Ah, you are right. I was in n^3.

          Submitted an n^2 solution and passed, keeping a 1d array.

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

    Problem B solution:

    For k%4==0 we have that (a+0)*b=0(mod 4) => a*b=0(mod 4), so if a is odd than we have that b must be divisible by 4(we have n/2 odd nubmers from 1 to n and n/4 numbers divisible by 4 from 1 to n), so we have that for k%4==0 there is no solution.

    For k%4==1 we have that (a+1)*b=0(mod 4) we can see that we can just print pairs that contains one even and one odd number(like {1,2},{3,4}, etc.)(same approach is for k%4==3(k%2==1))

    For k%4==2 (a+2)*b=0(mod 4) than we can split all odd numbers from 1 to n in 2 groups. First group is 1,3,5,7,n/2-1 and the second one is n/2+1,n/2+3,...,n-1. Odd numbers from first group is gonna be first numbers of pairs(a) and the second numbers of that pairs(b) will be numbers that are divisible by 4(than we have pairs like {1,4},{2,8}, etc.). In other half of our pairs second group of odd numbers is second number(b) and the first number(a) is the numbers that gives rest 2 divided by 4.

    nichke u can see my approach here

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

I DID NOT CHOOOKE!!!

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

upd: nvm i overcomplicated

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

Just guessed B looking at samples :)

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

    same i guessed a and b

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

    thats true however, its easy to verify the validation of the solution by bruteforcing the solutions however, i feel like the test cases are too weak i forgot to use long long instead of int when calculating ((a + k) * b) % 4 would it pass? ps : never mind i also made k long long ( however a and b is int) thats too an accident ( what a good accident)!

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

Was the round really balanced? I feel D1C is very easy and D1A2 (and A1) are crazy hard (almost I missed it).

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

    at least you didn't lose your mind optimizing the wrong solution for C lol

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

    idk, D1A1/A2 are quite simple with one observation, I missed A2 only because of i<=n in place of i<n in my code which gave me undefined behaviour :(

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

      What observation is there in D1A1/A2?

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

        you only need to xor segments of lenght either 1 or 2 (so when you find a sequence with xor 0, you can erase it for a cost = its length — 1, and you need to maximize such sequences)

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

        it's optimal to consider ranges which have their xor = 0 (i.e. xor(l,r)=0), cause you can always make them all 0 in (r-l) moves. Now just use as many ranges as possible, the rest you can make 0 in 1 move for each element

        Example:

        1 3 7 5 5 5 7 6

        You can xor ranges: [0,1], [1,2], [2,3], so range [0,3] becomes full 0,

        Then you can xor [4,5], so this range becomes 0

        Then xor [6,6] [7,7]

        You can't have more optimal solution for this case, and in general it worked for all cases, so the rest is only implementation details.

        At least for A1 I can tell precisely, it worked. If you're still curious, what I did:

        A DP[N][N] where dp[l][r] means number of steps to make range l,r 0. It works in n^2, which fits A1 restrictions

        then i did another dp, ans[i]=min(ans[j]+dp[j][i]), j<i. Answer will be ans[n].

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

    I mean, A might have been a bit tricky (maybe too tricky for an A), but crazy hard is definitely an exaggeration

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

why

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

I spent an hour trying to optimise 1C, then I realised you dont need to try all k = factors, just k = n/prime factor! Also, how do you prove that greedy works for 1B?

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

    I'm just the same as you. And I solve 1C in 1h51m, and don't have time to implement 1B. Haha

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

    sum of alternating fib numbers is bounded by the next fib. So if u have multiple things > the biggest fib, then not taking the biggest letter u have means that there will not be enough space to use it.

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

waiting for tutorial ...

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

div2 C , bet most of you all (who WA'd) got the approach right but missed some corner cases :D

»
2 года назад, # |
Rev. 3   Проголосовать: нравится +6 Проголосовать: не нравится
  1. Div2 C has too much corner cases, and Div2 DE is easier than Div2 C
  2. The gap between Div2D and Div2E is too small. I think the contest is not balanced.
»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

https://mirror.codeforces.com/contest/1180/problem/C and div2 C are very similar problems

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

How to solve div2 D1? I tried to use dp but failed.

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

    It is indeed DP. First it's easy to see that one either changes a[i] to i^x or changes a[i] to a[i]^x and a[i+1] to a[i+1]^x. So let's say that dp[i][j] stands for the minimum cost of changing the first i-1 elements to 0, and the i-th element becomes j. You can try to read my submission if you want: https://mirror.codeforces.com/contest/1719/submission/168590571

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

    Always do operation on a subarray of size 2. Go from left to right and maintain all possible values current element can have. If any one of them is zero then pass otherwise one more operation.

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

I used hashmap :(( RIP, hack is gonna be BRUTAL. At least I can do D1 tho

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

I tried as never and fail as ever

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

Problem E is a kind of Graph Isomorphism Problem, with many restrictions on the graph. And my solution is, ahem, to run a heuristic solution to the general case (+ a bit of optimization).

»
2 года назад, # |
  Проголосовать: нравится -50 Проголосовать: не нравится

in my opinion Div1: A1<B=C<A2<(a little bit)D=F<E

didn't have time to code F due to my stuck on A2

nice order

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

    I thought that B >>>>> A = C and that having subtasks in A was completely pointless, so your order is very surprising.

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

I think the author should give more meaningful sample. My program that have so many wrong place can still accept the sample in problem A and B. But I don't think giving contestant meaningless sample should be the difficulty of the problem.

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

How to solve E in something like $$$O(nm\log(nm))$$$?

I found an $$$O(nm\min\{n,m\})$$$ solution which unfortunately cannot pass:

You are checking if two bipartite graphs, with edges colored, are isomorphic;

For each component of the bipartite graph, if you sort all edges by their color, choose a starting vertex on the smaller side, then DFS would give a unique sequence that determine this component. But in my solution I have to iterate the starting vertex, thus ends up with $$$O(nm\min\{n,m\})$$$ complexity. Just do this to both graphs and check if they are the same.

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

    I had $$$O(nm \min(n,m))$$$ which passed the tests in 670ms, I think it was the intended or they would increase limits to make ti TLE. However, Um_nik managed to get it in 140ms. Maybe he found a better solution?

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

      I guess hashing paths of length at most $$$O(\min\{n,m\})$$$ starting from each vertex is correct? If so, this would decrease constant by a lot.

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

        I don't think I did that. I just hashed the entire grid.

        My code for reference

        Edit: It seems they decided to change the constraints of the output format to be annoying (it used to be $$$2 \cdot 10^6$$$) and now the above code is WA....

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

      My submission: 168607716

      I guess they added some tests after it was 140 ms, but it is still reasonably fast. $$$O(nm \min(n, m))$$$ too, no hashing, if you match one pair of vertices, there is at most one way to match their connected components, just run two parallel dfses.

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

    Added

    #pragma GCC optimize("O3")
    

    And it now passes in 1400ms

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

Sad, I wrote div2F a minute before the end. Fixed the bug 2 minutes after the end.

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

Thanks for the good question.

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

Why this solution of problem Div2.C get WA2 ?? I test it against thousands of random test cases but I didn't find the Wrong answer.

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

I don't understand where my solution is going wrong for problem Div2. C.

Submission : 168591816

Solution : Let $$$cnt$$$ be the number of rounds before the $$$i$$$th player, $$$cnt = max(0, i - 2)$$$then, if $$$cnt \ge k$$$, then, the $$$i$$$th player cannot play. Otherwise, subtract $$$cnt$$$ from $$$k$$$, so, now we have the maximum number of rounds the $$$i$$$th player could win, $$$k' = k - cnt$$$. If the $$$a_{i} = n$$$, then, we win all remaining rounds, else, if the prefix has some $$$j$$$, such that $$$a_{j} > a_{i}$$$, then, $$$i$$$th player can never win, otherwise, the suffix must have some $$$j$$$ such that $$$a_{j} > a_{i}$$$, the maximum we can get is the next greater element, which yields an answer $$$1 + min(k - 1, j - i - 1)$$$.

Please help me if I have made any wrong statement or I have misunderstood something.

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

I think one reason why the author hasn't put tutorial out is that he is strengthening the tests of F. $$$O(nC \sqrt q)$$$ passes pretests. Amazing.

edit: It's actually $$$O(qC \log \log C)$$$, which is still not the intended time complexity.

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

    Fun fact: you can use bitsets to get a smaller total number of operations.

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

    I believe if you analyze my algorithm carefully, it is $$$O(q C log(log(C)))$$$, still too slow of course (somebody uphacked me), but closer to passing than you might think. I was aware that it could be too slow, but roughly quadratic for $$$10^5$$$ is worth a shot.

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

      Yes I know the analysis, but I wouldn't have a try because I trust the author would be responsible for the task. I admire your courage to write the code with little chance to pass, but I don't think any responsible author would make such a mistake.

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

        When writing the code I thought my code had a better complexity than it actually has. 5 minutes before the end I saw that the complexity was actually pretty bad. I submitted anyway, because it is only a penalty of -50, and the reward is way higher.

        Edit: I thought you also got a -50 penalty when getting WA on a problem you didn't solve. Turns out I am wrong.

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

For Problem C in Div2, Can someone point out the mistake in the below logic.

Logic

(My submission — 168599929 — WA on Pretest 2)

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

    what if k has become negative try to output max(0,Math.min( highestNoIndexOnRight-I-1 , K));

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

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

This score distribution sucks. I solved 3 problems, but got as much points as those who solved only 2, cuz of wrong submissions on B and C. If it was ICPC-ruled, I'd had penalty = infinity, but still would be higher cuz solved more problems...

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

How many participants are aware that, unlike Berland, Buryatia is not a fictional land? :)

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

Can anyone explain why does 5000 * 5000 is giving MLE in D1 ??

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

C was nice one... applied maxtillnow and nextgreater still got WA

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

Hi,

For anyone that solved Div1C/Div2F, how do you prove that checking all cycles of length $$$\frac{n}{p}$$$ for prime $$$p$$$ is sufficient? I was setting $$$p$$$ as all factors of $$$n$$$ instead, and spent most of the contest optimising something that wasn't even intended...

Thanks!

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

    Imagine you have $$$\frac{n}{pq}$$$. This means you are collected $$$pq$$$ thing. Let's label them $$$1,2,\ldots,pq$$$ from left to right. If we used $$$\frac{n}{p}$$$ instead, we would collected $$$1,q+1,2q+1,\ldots$$$ or $$$2,q+2,2q+2,\ldots$$$ etc. etc. instead.

    The mean of the (mean of each smaller sequence) is equal to the mean of the original sequence. Therefore, at least one of the sequences has a mean that is greater than or equal to the original sequence.

    Another way to think about it is to think about why they banned jumping with a distance of $$$n$$$.

»
2 года назад, # |
  Проголосовать: нравится -22 Проголосовать: не нравится

好疲惫啊,有点乏力

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

Test cases for C Div.2 were really weak, because O(n*q) will pass.

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

    In every query, you can take for from 0 to index of given number to check if there is bigger number than given.

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

How to solve D1A2?

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

    Transform [l, r] into (r — l + 1) / 2 segment with length of 1 or 2 unit.

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

    An array of size $$$n$$$ can be cleared in time $$$n$$$ by simply applying the operation on each element one at a time, or by applying the operation on two elements at a time (first and second, then second and third, then third and fourth, etc), until one element remains for one more final operation. The nice thing about the time being exactly equal to the size (no additions or constant factors) is that the total time is unchanged even if we partition the array into any number of subarrays of any length and apply the procedure separately on each subarray.

    The only way to actually save time is if there is a subarray for which the XOR of its elements in equal to 0. Then when we apply the operation on two elements at a time, the last remaining element will be 0, so we don't need to perform the final operation. Thus, we save one time unit for each such disjoint subarray, irrespective of the locations or sizes of these time-saving subarrays.

    How do we find these time-saving subarrays? We can maintain an running XOR of the elements, and record each result. If our running XOR is $$$r$$$ before entering a time-saving subarray, then the result after we see the last element of this subarray is $$$r \oplus (\text{XOR of subarray}) = r \oplus 0 = r$$$. So when we see a residue again, then we know that we found a time-saving subarray. We don't care about when this subarray begins; only that it saves us one time unit. Our time-saving subarrays need to be disjoint though, so we need to reset $$$r$$$ after this.

    tl;dr — Declare a residue set and initialize the residue to 0. Read through the values, applying the XOR operation to our residue. If the result is not in our residue set, then insert it. Otherwise, increment a counter, clear the set, and reset the residue to 0, and continue.

    My submission: https://mirror.codeforces.com/contest/1719/submission/168615233

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

Check out my Div.2 C solution without queues, dequeues or vectors:

https://mirror.codeforces.com/contest/1719/submission/168582562

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

Div2 C test cases could have been better tbh, you just covered 2 cases where a[i] == n (we win everytime after max(0, i — 1) games) and where i is higher than the position of n (answer is 0)

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

Once you realise that A has to do with the parity of n and m, the kind authors have already provided the answers for all cases of odd and even in the samples. Thanks sirs!

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

Why this naive Mo's algorithm can pass system test of Div.1 F? I think simply place the primes one by one can hack it.

https://mirror.codeforces.com/contest/1718/submission/168599096

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

After 21 months of perseverance, I finally became an expert. After countless frustrated and frustrated nights, my hard work has paid off. I will keep trying to be a CM and never give up. Bless all those who struggle.

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

For me, my solution for div1B is a total mystery. I have no idea how an apparent backtracking could pass in 233 ms. However, the problems were not very interesting and, combined with some overthinking it was catastrophical. Hope to see some better div1 A and B problems in the future:))

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

Ratings updated preliminarily. We will remove cheaters and update the ratings again soon!

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

bad and strange tests in Div1B

during contests I had submitted $$$O(k^2\log k)$$$ solution per test, it passed pretests in 800ms

I resubmitted faster version before end of contest paying 130 places

After systest original submit have passed tests in 1300 ms (!!!)

I tried to hack it with exterimely stupid test and it was successful 168605608

generator

So, wtf is tests in this task?

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

    I would argue that setting $$$t$$$ large with $$$n$$$ really small is just bad practice in general -- with such small values of $$$n$$$ it often happens that constant optimization matters more than complexity and as such it becomes really hard to intuit if your solution will pass in time or not.

    Adding a n<45 check to your code makes it pass reasonably comfortably for the stupid test, at least: 168630258

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

Okay i think problem C should have had more points assigned to it compared to problem B. In my opinion problem B was easier, i got baited by the point values.

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

I spent a lot of time on Div2E thinking that there is max flow or min cost max flow solution but i did not figured out how to use it. Sad :(

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

Quick review for D1 ABC:

A: Answer = n — (max # of disjoint intervals that has xor sum zero). A fair problem.

B: First check if sum(a) is sum of Fib numbers. Then brute force where Fib(n), ..., Fib(0) comes from. I never know why backtracking runs so fast.

C: For each divisor d of n s.t. $$$n/d$$$ is a prime, use a segtree/multiset to maintain $$$\max_{0\leq i < d}\sum_{k} a_{kd+i}$$$. There are at most 7 such d-s. Therefore, it won't TLE. Quite a standard problem.

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

can someone help me figure out what's wrong in my code for problem Div2-B and what is the possible test case it is failing. https://mirror.codeforces.com/contest/1719/submission/168580820

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

Question C was hard to implement

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

d2E is among the worst problems I have ever seen on this platform

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

In problem A of Div2, please explain how Tonya wins in the testcase "2 2". I don't understand that.

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

    Burenka is at (1,1) so she can either go to (1,2) or (2,1). From both cases Tonya plays chip at (2,2) , since it is the corner, there isn't any more place to go for Burenka.

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

      I didn't get it. Burenka starts at (1,1), then lets say she moves to (1, 2) after than its Tonya's turn. He starts at (1, 1) and lets say he moves to (2,1). Now Burenka's turn, she moves to (2, 2), which is the only possible cell. Now it's Tonya's turn but he can't go to any cell according to the conditions in the problem. Thus Burenka wins. Where am I wrong here?

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

        it seems like you misread the statement tonya will start from the index where burenka left and then burenka start from the index tonya will left and so on

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

        They are moving the chip , not moving themselves

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

A fun fact about Div2 A: the outcome does not depend on the players' moves.

Hint. The parity of the Manhattan distance to the destination alternates between moves, and a move is always possible when that distance is odd.

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

i have tried out every single test case i feel like but i dont know where am i going wrong. can anyone pls look into it. https://mirror.codeforces.com/contest/1719/submission/168625241

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +19 Проголосовать: не нравится
    Your code fails on:
    Correct output
    Your output
    How did I get this test?
»
2 года назад, # |
  Проголосовать: нравится +4 Проголосовать: не нравится

editorial?

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

DIV2 (ABCDEF)video Editorial for Chinese :

Bilibili

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

When will we be expecting the tutorials? I struggled on question D1, could someone shed some light on the problem?

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

    First, observe that there is no benefit to applying the operation on a range of more than 2 elements, since it doesn't save any time compared to applying the operation multiple times (on ranges of size 1 and 2 only).

    Applying the operation on one element at a time will cost $$$n$$$ time units. Applying the operation on two elements can guarantee zeroing one element, but we'd then need to include the other in the next operation. We can perform this kind of pairwise sequence of operations until one element remains, which we apply a final operation to. This also costs $$$n$$$ time units.

    How do we save time? If there is a subarray of $$$k$$$ elements such that XORing all elements results in 0, then we can perform the pairwise sequence of operations on this subarray. The one element that remains must be 0 after this, so we can skip the final operation and spend only $$$k - 1$$$ time. This generalization also includes the case of $$$k = 1$$$ (if an element is initially 0, we need 0 operations to zero it).

    DP solution (works for D1): For an array of $$$n$$$ elements, if there is a suffix of say $$$k$$$ elements whose XOR is 0, then we can apply the optimal solution (through DP) on the first $$$n - k$$$ elements and then start a XOR chain for the last $$$k$$$ elements. We would, however, need to try all values of $$$k$$$ to find which suffixes XOR to 0, and pick the one with least time. Even if the suffix does not XOR to 0, we need to store the result, so that we can quickly extend the chain to a new element (instead of recalculating the XOR chain). My approach defined $$$dp[i][j]$$$ as the result of the XOR being applied from index $$$i$$$ to index $$$j$$$: https://mirror.codeforces.com/contest/1719/submission/168605232

    This has $$$O(n^2)$$$ runtime, so it won't work in D2. A 1D table should work too (since it's only the different starting points we care about), but I didn't bother refining this further and it would still take $$$O(n^2)$$$ runtime.

    Counting solution (works in both D1 and D2): Actually simpler than DP, but you need the additional observation that the locations and sizes of the time-saving subarrays (where the elements in the subarray XOR to 0) are completely irrelevant. Each time-saving subarray saves one time unit regardless, so the optimal time is simply $$$n$$$ minus the maximum number of disjoint time-saving subarrays. We can detect a time-saving subarray by maintaining a running XOR and inserting the results in a set. If we receive the same result twice, i.e., $$$r \oplus a_i \oplus a_{i + 1} \oplus \cdots a_{i + k} = r$$$, then the subarray $$$[a_i, \ldots, a_{i + k}]$$$ XORs to 0 and saves time. We don't need to know when this subarray starts; we just need to detect when it ends, allowing us to increment our saving counter and reset the XOR chain. You can check out how simple it is here: https://mirror.codeforces.com/contest/1719/submission/168640804

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

      Andalus, can you please explain What it actually means by " disjoint subarrays with XOR of 0 " . Actually a little bit confused in understanding that. For example on array :(in case you want to know) 1 3 2 1 2 3 1 ,

      I kind of got stuck on this.

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

        Note that $$$1 \oplus 2 \oplus 3 = 0$$$. So for the array $$$[1, 3, 2, 1, 2, 3, 1]$$$, the subarrays $$$[1, 3, 2]$$$ (first three elements), $$$[1, 2, 3]$$$ (fourth to sixth elements) and $$$[2, 3, 1]$$$ (last three elements) all satisfy the property that the XOR of the elements is 0. Let's denote this as a 0-XOR subarray.

        So for example, we can zero out the first three elements in two operations as follows: $$$[1, 3, 2, 1, 2, 3, 1] \to [1 \oplus 1, 3 \oplus 1, 2, 1, 2, 3, 1] = [0, 2, 2, 1, 2, 3, 1]$$$

        $$$[0, 2, 2, 1, 2, 3, 1] \to [0, 2 \oplus 2, 2 \oplus 2, 1, 2, 3, 1] = [0, 0, 0, 1, 2, 3, 1]$$$

        In general, if you have a 0-XOR subarray of $$$k$$$ elements, then this subarray can be zero'd out in $$$k - 1$$$ operations. So we can partition our original array as $$$[(1, 3, 2), (1, 2, 3), 1]$$$, where the brackets represent 0-XOR subarrays. So it takes two operations to zero out $$$(1, 3, 2)$$$, two operations to zero out $$$(1, 2, 3)$$$, and then there is a $$$1$$$ remaining that needs one operation (number of operations to zero out elements outside the 0-XOR subarrays is equal to the number of such elements), for a total of 5 operations.

        Alternatively, you could also partition the array as $$$[(1, 3, 2), 1, (2, 3, 1)]$$$, which also requires 5 operations. There are actually three 0-XOR subarrays in the original array, but two of them overlap, so we can only exploit at most two of them, hence the need to count the maximum number of disjoint 0-XOR subarrays.

        In any case, since we can have two disjoint 0-XOR subarrays from an array with seven elements, the output should be $$$7 - 2 = 5$$$, regardless of the size and location of these 0-XOR subarrays.

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

Why does Tonya win if the case is: 1 5? Cant Burenka just move 5 to the right and Tonya cannot do anything?

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

Can someone please tell me why a specialist won the div 2 round? Did the guy purposely create a new smurf account?

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

    This is only their fifth contest, with their first contest being in July 31st, so it's very likely that they're simply new to Codeforces but are actually really skilled and experienced in CP (through numerous other mediums). So even though they start as grey, they would perform far above what's expected of their current rating, (getting a significant boost from each contest) until they reach the rating that more accurately reflects their skill level, at which point it would be more stable.

    While it's unfortunate that someone who might be Div 1 tier is rated in Div 2, the reality is that we won't know that they're Div 1 tier until they prove themselves through these very same contests that they would dominate in. If they really are Div 1 tier though, it shouldn't take long for them to reach a more accurate rating.

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

      fifth? That's not true. It is only their second. Also, out of the top 5 in div 2, only one of them (TasselFlower in 3rd place) has actually competed in more than five contests. I don't see why so many people who are so good at competitive programming will only just be joining Codeforces given how big of a platform it is. It only makes sense for me to think that they either cheated (which I don't think so) or that they have created new accounts

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

        Sorry, I mistook who you were referring to. I do think there are many outside Codeforces who are so good in competitive programming, due to the numerous other alternative mediums. In fact, I myself used to train through weekly offline contests at university, and I would prefer that over Codeforces if it was still an option for me now.

        I think the use of alt accounts to participate in contests below your actual level would still qualify as cheating, but in any case, I don't think there's any evidence that suggests that whether it's an alt, a cheater, or someone new to CF. But unless it's a cheater, they should quickly jump up to the appropriate rating and this should no longer be an issue.

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

The recent contests are so wrong. There's a huge gap between C and D

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

    Not really. Look at LightBrand's solution of D1 and D2 above. It is quite simple apart from the fact that you have to make some key observations.

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

I resubmitted my code of problem div1c several times after the contest, which has got a TLE(above 3000ms) on the system test, but it passed all the tests in below 2800ms each time ...(including system tests)

I think the efficiency of the judging machine has fluctuates too much.

submissions:

TLE,during the contest: 168600537

AC,after the contest: 168640013

Is it possible to rejudge my submission?

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

Problem D1 and D2 is my favourite

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

When will the editorial be published?

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

the postcard turned out to be a cyclic array

bro what

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

I am a newbie,where can I find the tutorial of this contest?

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

What does "Unexpected verdict" mean in hacks?

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

Now I'm uphacking solutions of Div2E/Div1B and I used the data generated by:

Code

But I received the verdict "Unexpected Verdict". What does it mean? Does it mean that the authors' code can't pass this test so it's unable to judge or something? If anyone has seen verdicts same as mine please give me an explanation, thanks :)

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

    When I set $$$T=1$$$ it shows "Unsuccessful Hacking Attempt" but why when $$$T=10000$$$ I receive "Unexpected Verdict"? So is it reasonable for me to doubt that the authors' code gets TLE on this test?

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

      I think it's reasonable for you to suspect that the authors' code gets TLE'd on this test. I think hacks are judged by first validating that it satisfies input constraints, then running them on the authors' solution to generate the correct answer, before running them on the hack target's code. But if the authors' solution itself doesn't pass (due to TLE, MLE, or anything other than "Wrong Answer"), then it would make sense to consider this as an Unexpected Verdict.

      I don't know for sure whether this is the case here, but it does sound like the most plausible explanation (especially with how tight the limits are).

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

    I don't think this affects the Unexpected Verdict, but your code contains an signed integer overflow, because the 50'th fibonacci number is too big to fit into an int.

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

      Oops, I just wrote a simplified version of my code in the comment so I didn't notice that, sorry. But my original code uses long long which gets the same result. Also I only used the first 43 fibonacci numbers (which is actually $$$\le 10^9$$$) so int is enough for them.

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

UPD: I'm sorry I checked on other compilers and the answer seem to be correct.

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

Видно что русские составляли :)

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

Can anybody help me find a testcase for Div.2 C where my code(168707975) fails? I tried to use all the ones posted here and they seem to work. I've simulated n-1 fights till the n comes to the first position, storing indices where a number wins and loses.

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

Hi, I got a message from the system saying that my solution is similar to that of another user. However, this is because we both use the same template which can be found at https://github.com/JaroPaska/competitive_cpp_17 and was published before the competition.

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

A good round