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

Автор PoPularPlusPlus, история, 11 месяцев назад, По-английски

Hi Codeforces!

I welcome everyone to participate in Codeforces Round 882 (Div. 2) which will start on Jul/06/2023 17:35 (Moscow time).

The round will be rated for participants of Division 2 with a rating lower than 2100. I would encourage Division 1 participants to participate in the round unofficially.

You will be given 6 problems and 2 hours to solve them. One of the problem is interactive, so please read guide for interactive problems if you are not familiar with it.

the theme of the contest is

All the problems are prepared by me and StArChAn.

We would like to thank:

Also, the editorial video for all the problems will be available on my channel right after the contest ends

All the best everyone!! Eager to see you going All Around The World and being Unstoppable in climbing the ranklist.

UPD: Scoring distribution — $$$500 - 1000 - 1500 - 2000 - 2750 - 3000.$$$

UPD: For video editorial of the problems, you can find it here

UPD: Editorial is out.

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

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

Finally a contest after almost a week!

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

    Worst contest I have ever seen!..

    The queue at the beginning and the statement of the problem D was awful.

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

    Solution to C

    All that matters is how fast you can google. HATE SUCH CONTESTS,

    Message for Authors — At least make some new problems instead of useless & BULLSHIT stories. Codeforces pays you for a reason.

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

      If you used your head you would realize that due to the small constraints that you can brute force instead of googling an algorithm. Not only did you reveal you are not very good, but also that you were cheating

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

        Googling isn't cheating; it's allowed in the CF rules

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

        yeah and that brute force TLE's for some people because of the trash constraints , exact same sol as my friends and im the only one TLEeing

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

          you got TLE because your implementation is sucK man (O(T * MAXN)). Don't blame.

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

            nah i meant the very first submission its clearly implemented the same way with my friends and they got ac there is the sum of n thing wdym T

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

        Dear friend I got to know after contest that the solutions are available as it is on internet. I'm not like you who starts googling, after trying for 5 minutes. Also, No offence to setters, The questions were good but The language framing was a piece of shit rather shittiest piece of shit, That's why I was so frustrated. Also doesn't matter if you downvote it 100 or 1000, THAT'S WHAT IT WAS

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

          I do not know what I did to suggest to you I was googling. The statements were good and I read them without trouble. In fact they were fairly typical statements. Maybe you can improve reading.

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

      I guess it's hard to create an easy problem that wasn't already on CF or anywhere else just because every contest has a lot of easy tasks. I think you might be able to google A, B is just another "go through array while maintaining some values"

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

    All these submissions have a same function for problem C 212411474 212408231 212415822 212444362 212445049 some of them have removed comments otherwise the functions and structs are same.

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

I went nowhere and did based testing.

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

I went to Antarctica and did kinesthetic testing.

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

I went to Narnia and did soulful testing.

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

--Deleted--

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

Is one of the problem named Treelike?

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

Finally a contest after a week. I can feel my heartbeat again.

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

Setters and Testers are Indian youngsters , let's see .

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

since this is being set by indians my guess is there would be problems on graph and bits.

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

Is one of the anime Vinland saga?

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

As a fan of [user:darrkcyan], I recommend you to participate this contest:))

»
11 месяцев назад, # |
  Проголосовать: нравится -23 Проголосовать: не нравится
»
11 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Excited for the contest.

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

Finally I'm going to be rated!!

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

Надеюсь на интересные задачи) Спасибо за уточнение про интерактивную задачу!

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

Let me guess, is the anime Horimiya?

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

first time seeing a grey tester! hope the contest is good.

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

I hope one of the problems is related to One Peice .

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

I went to Alaska and did master level testing.

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

Atekichan Finally your time to shine!!

»
11 месяцев назад, # |
  Проголосовать: нравится -37 Проголосовать: не нравится

i have a bad feeling about this round...

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

    Nothing's too hard if you are prepared and god willing.

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

      plus, what are you so worried about. Non-rated people like me will always have their rating increase, cause your rating can't go down if it's your first rated competition. :thinkies:

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

Enjoy every competition

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

Anime Prediction List :

0) DeathNote, (Involves mental games )

1) Code Geass ( Considering the theme is Coding, this one fits ),

2) PsychoPass

3) Naruto ( So many fans )

4) Black Clover ( So Many fans )

5) Demon Slayer,

6) One Piece,

Keep the list going :D .

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

Waiting for this!

»
11 месяцев назад, # |
  Проголосовать: нравится -13 Проголосовать: не нравится

GOODJOB!

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

I went to Antartica and did gawky testing.

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

Is anyone left for taking part in the contest?

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

Hope to reach cyan after the contest.

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

As a tester,tasks are nice and wish everyone good luck (〃•ω‹〃)♡

»
11 месяцев назад, # |
  Проголосовать: нравится -15 Проголосовать: не нравится

I am writing this comment to inform you that I have nothing to do with the similarity between my code and other people's codes please do not do anything to my rate I hope this will never be repeated

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

score distribution when?

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

I wonder why MikeMirzayanov has more contribution than anyone but doesn't show up on the leaderboard for Top contributors...

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

Indian setters and testers means contest with bits questions :)

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

Its time to purple again :)

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

Hope to get to CM!

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

Balanced score distribution

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

Yay Siruseri Round!!

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

I will become specialist :)

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

My unmatched perspicacity coupled with my sheer indefatigability makes me a feared opponent in any realm of human endeavor.

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

Huge gap from D to E. Interesting!

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

    I'm not sure, but he mentioned scoring distribution instead of rating, so it's difficult to determine the gap between D and E, right?

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

      Yeah I guess that, anyway, enjoy the problems ^^

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

        I'm sorry, you are right. It seems that a high contribution can indeed indicate some issues.

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

Please remember to add a space after +!? in interactive questions.

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

excited to participate!

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

Hard problems for me :(

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

There seems to be some issue with the queue. Solutions submitted later have been judged, but the ones earlier in queue are pending.

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

You thought it was a programming contest but It was I, Dio

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

W Contest

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

there are few bitwise operations today thx

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

Bitwiseforces

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

this contest very very very hard

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

just keep in mind we don't have time to keep searching for your ANIME things :(

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

too hard

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

GFGforces

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

how to come up with the idea for the problem c for the first time if you have not used(implementation) trie before and is there any other solution?

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

    I dont know, in my room there are like 5 solutions with same structure "Trie". I begin with C, and send it in 5 minutes after. Just use that numbers are small:) You can see my easy submission

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

    using the two properties of xor :

    a^0 = a

    a^a = 0

    hence we can choose any subarray we want by choosing first r to m then l to m , hence the problem becomes finding the subarray with maximum xor

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

      yep but didnt know how to calculate it in O(N) without trie

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

        It can be easily solved in O(2 ^ 8 * n) which passed tests

        Just support all possible xor of segments ending in i'th element. Because a[i] < 2^8 then xor also < 2^8.

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

    Any value which you will append is going to be xor of any subarray. And you can append any xor subrray in 2 operation. So you just need to find maximum xor of all subarrays

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

    If you can find the pigeonhole principle in the prefix XOR values, then you will have to look forward to only 256 indices for an index i. So, it can be solved in O(256n)

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

    I think , the best way to deal with such questions is to , to do the operations specified in the questions by yourself. Like if you randomly do some operations you start getting hints about the problem and patterns emerge . That's atleast the way I do for such problems . Hope it helps

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

    You may notice that due to constraints number of different prefix-xores is small (not greater than 257), so if you sort them and apply the 'unique' operation, you can use brute-force to find a maximum xor of all pairs.

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

LtoR forces bitwiseForces SpeedForces jojoforces

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

Can we solve F like that -: We have to find the smallest subarray with or greater than v. Now if we fix the start index say l, then there can be at most 32 index r, such that or of subarray a[l..r]changes. So we store all these 32 indexes for all l from 1 to n and use prefix minimum for the query?

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

In problem D, second sample, query 2, why is the answer 3? After flipping a3, a5, the only ones which are in t(s) are a3 and a7, ans <= 2. What am I missing?

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

    I think the answer is 3 because:

    • Swap pos1 (1) with pos2 (0)

    • Swap pos4 (1) with pos5 (0)

    • Swap pos6 (0) with pos7 (1)

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

    Dude I swear I wasted 30-50 mins because of this similar doubt and was unable to solve D fast enough. But the thing is that there are some 1s which are not in t(s) and we can use them

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

      Even I didn't realise that we can use the 1s that are not in t(s), I realised it after contest :(

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

I bricked C hard. I could not for the life of me figure it out until like the end of the contest. :/

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

Anyone else misread D's statement, thinking we swap elements in T(s) instead? :( wasted an hour

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

What's the idea for the solution to Problem F? I have gotten a bunch of insights but haven't been able to formulate the complete solution.

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

I liked the ideas of the problems, but my request to you, since there are many religious people that love to participate in CF contests, is to not use phrases like "The Man who became a God" in the problem title or description. Thank you.

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

What is this obsession with Bitwise operators and GFG ? Make some original problems.

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

As I understand it, in problem C, you need to find a segment with the maximum XOR. Is there any well-known way to do this? Two pointers don't work here.

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

      I see, that too many ppl just copy all code there. Seems all of them can get "cheat plag".

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

        Nope. You can copy code published before the contest has started

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

          Of course you can. But the plag system is now a human, if like 1000 solutions are really the same(with the same comments:)), they can be plag. I am pretty sure, that anyone will not unplag such 1000 ppl:)

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

        No, the solution was already available before the contest on a public platform.

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

    A solution without tries- First find the prefix xor array. for the given constraints on ai, you could just iterate the prefix xor array from left to right and maintain a 256 sized boolean array which stores whether a certain number has been seen before in the iteration or not. Hence at every iteration just iterate over this boolean array, if a number has been seen then just xor that number and the current value of prefix sum and take max of it with the current best answer!

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

      This works with ai<=2^63. This is maximum xor pair but it can easily be extended to maximum xor subarray.

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

      Yup I did this. I used a set to store all the visited prefix XOR's tho

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

        Oh, I was a bit paranoid about this approach cuz this can in the worst case add a factor of log(2^8) to the time complexity

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

Runtime error on test 13 at problem D. Really sad, I was getting close to purple.

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

Nice round! I enjoyed how Problem C masked the well known problem of maximum subarray XOR, but I think it might be unfair for people who tried to come up with the solution on their own rather than Googling, since the most common solution uses a Trie which would suit Problem D more.

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

Cool contest! though i had troubles since i haven't written contests in a while

I saw my friend solve D in 25 mins, and rushed to solve D before C, came up with the solution quickly but implemented it too slowly, ac-ed, got a low score for it 30 mins before the end, and solved C 3 mins before the end. Happily the contest was prolonged for 15 mins:)

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

Was the last submission considered over the first? I thought that it is so, only if first submission failed FST :(

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

Any hints for D? I'd like to try solving it on my own

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

    I thought about assigning priority to each index, ig this might serve as a hint if this is in the correct direction, can anyone confirm this?

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

    Give priority to each character, according to their first appearance in $$$t$$$. Then if you have a lower priority character as $$$'1'$$$ and a higher priority character as $$$'0'$$$, swapping them will be better.

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

    $$$t(s)$$$ can be annoying, can you solve it when the goal is to make the following string as large as possible?

    (Goal 1)
    (Goal 2)
    (Goal 3)

    Once you have that, you have solved half of the problem, can you solve the full problem?

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

Any good hints to solve F?

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

Don't like C at all. It's just duplicate of https://cses.fi/problemset/task/1655. Furthermore, I was suprised by the quantitiy of people could solve it in the contest after 1 hour passed, since Trie is not something most people could know and implement.

Yeah, honestly I just want to imply that the majority copied and pasted the solutions. But i think the main point here is about problem setters. It's okay to use some of small problems , but not to use the whole of them adding to a single C.

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

    You can solve it just by brute force because ai <= 256

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

    It is sad to see the author didn’t even check that the question is easily googlable and hence so many people copy pasted the solution and since the code they copied was written pre contest they won’t even get a Plag.

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

I wonder where they got the idea for Problem-C:

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

Try to make beautiful problems not a beautiful blog.

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

what time can we read others code?

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

HAHAHAHA, FUCK ME, TL ON D CUZ OF THIS SHIT:

j = *upper_bound(st.begin(), st.end(), j);

INSTEAD OF:

j = *st.upper_bound(j)

HAHAHAH, ADORE PROGRAMMING))))))))))))

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

I read the title of problem A, well that made me thought the contest's theme was DeathNote =))

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

PoPularPlusPlus can you please post blog editorial on Codeforces:

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

A pretty bad contest, its difficulty is more difficult than the number in the problem.

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

A: Sort the array of {a[i]-a[i-1]} and choose n-k minimum elements.

B: Let A=a[1]&a[2]&...&a[n]. If A>0, then for all 1<=i<=n we have a[i]>=A, so if there are more then one groups, the bitand of each group will be at least A, and the sum will be at least 2*A > A, so there can be only one group. If A==0, we can build groups greedily from left to right (by choosing the minimal prefix of remaining elements with bitand==0).

C: By trying for some small cases we can find that all possible values of strength are the xor-sum of some ranges [L, R], we can find them in O(max(n^2, n+(2^8)^2)) = O(2^8*n).

D: For numbers in [L1, R1] we let a[L1]=1, a[L1+1]=2, ..., a[R1]=R1-L1+1, because s[L1] is the first element appears in t, s[L1+2] is the second element appears in t, and so on. For numbers in [L2, R2] and not in [L1, R1] we assign values to a[i] by the order s[i] appears in t. Using an ordered set we can process all m ranges in O(m+n*log(n)). Assume there are k numbers in any range [L, R]. For answering queries, let's assume there are x occurences of 1, then for all i such that a[i]<=min(x, k), we need do operations to make s[i]=1. Then we can answer the queries by fenwick tree.

E: untested problem.

F: If we let b[i]={a[1], a[2], ..., a[n], a[1], a[2], ..., a[n]}, then we can see all values appear in {a[n+1], a[n+2], ...} are some range-bitor of b[i], and for ranges with same right bound and same value of bitor, we only need to keep the smallest range. For each right end, there are most log(max(a[i])) different values of range-bitor, and we can find them by sparse table and binary search, so we can solve the problem in O(n*log(n)*log(max(a[i]))).

pattern of F
»
10 месяцев назад, # |
  Проголосовать: нравится +5 Проголосовать: не нравится

Anyone else overkilled problem A with dp?

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

    Hmm :\

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

    I was literally thinking that how can problem A be dp and read the problem's constraints too many times before submitting

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

    Wasted like 10 minutes implementing the DP solution, got annoyed, stopped to think, facepalmed, submitted the greedy — AC.

    Lesson: Don't take breaks from CP.

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

      For me implementing DP was easier than coming up with the greedy solution.

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

    For the long time(about 25 minutes) I was thinking smth like: "Nah, it's the first problem, there should be easier solution". The result was just wasting these 25 minutes, 'cause I've written dp solution finally.

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

No written editorial?

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

hmm

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

    bruh, its not same, there are more simple a[i]<256 u can just do N*256, there are no even need to think (if u know prefix arrays)

    Also it fair

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

    It's kind of hard to reduce the problem down to max subarray xor, so I think it's fair

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

Just not my day I guess. .

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

    Someone please help me with B, didn't we just needed to find the maximum segments that had the same "&" as that of the entire array, such that all segments have that same "&".

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

      that's right when the and is 0 but when it is anthing else the answer is always one group as adding more groups will always give higher sum

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

      We need to find the minimum sum of bitwise and. Suppose the full array has bitwise and $$$3$$$. If you find two subsegments, both with bitwise and $$$3$$$, the sum of those is $$$3 + 3 = 6$$$, which is more than $$$3$$$ and not optimal.

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

        Yup, just realised that on watching the video editorial that I did not think it through correctly, I messed it up badly.

        Atleast I have my intuition to not google to blame for C. :⁠-⁠|

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

      No, I also did the same mistake. Take an array like 2,3,2 Bitwise& of all element will become 2. Now you will traverse the array and find the subarray of minimum length(so that you can maximize the ans) such that bitwise& of its all element is 2. That's wrong. This will lead to two subarray — [2],[3,2]. Sum of these subarray is 2+2=4. However if you take all elements in single array, your minimum bitwise& of all element will be 2 itself. So, in summary, when bitwise& of all element is >0, answer is simply 1.

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

      Let biwise AND of all the elements equal to k,

      Case 1: k == 0 : Try to create maximum number of partitions such that AND of all partitions = 0.

      Case 2: if k > 0 , it's always optimal to create only one group, i.e. the whole array. Reason :--> It's easy to prove Bitwise AND of any partition is >= k , hence more the partitions, more will they contribute to sum, so make just 1 partiotion with AND = k

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

    If every round that had problem that after thinking is reduced to standard problem as most major component is unrated, almost every round would be unrated.

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

    in problem C you need to make some observations before that, so no

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

    There is a bunch of stuff to prove like why making same operation multiple time on index doesn't make any difference and the answer is some subarray, the expected solution(though the editorial is not out yet) most definitely doesn't use trie so that shouldn't be the problem either, the constraints were low for some reason, but its true that the answer was easily guessable, if the observations were a bit hard then the problem would have been nice.

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

    easily you can see that the task is finding the max xor range it's obvious, everyone knows that a^a = 0 this is the only reduction you need and its also a well-known property of xor, if you just copy standard problems and rephrase them almost every round will be googlable! and worthless. it's okay to use standard ideas in a multitasking problem or make from them a new variation but anyone can just copy the code from gfg with no understanding of it at all and it will pass! , this is my opinion i respect all your points but it is just not fair.

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

      easily you can see that the task is finding the max xor range it's obvious

      You say it's obvious but in a 101 word comment you were unable to explain why it is obvious.

      The fact that one can guess the task without proving it is the correct solution is not ideal and the most interesting problems make it hard to guess the idea, I agree.

      anyone can just copy the code from gfg with no understanding of it at all and it will pass!

      Thankfully everyone has access to the internet, so it's an equal playing field when it comes to fetching code to solve standard problems. You can carry on and have fun with the remaining 5 problems in the contest instead of complaining.

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

        Actually its rather obvious since operation on a index is performed only once(two operations will just introduce a zero) its simple to just jot some equations down and see the result that it always leaves a subarray xor

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

          If you have to "jot some equations down" to convince yourself it is true, that's not what I call "obvious". But maybe we have different definitions of the word.

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

        everyone knows that a^a = 0 this is the only reduction you need and its also a well-known property of xor

        That's why it's obvious. you can take any suffix you want and delete from it(a^a=0) any other suffix and it gives you any subarray you want.

        Thankfully everyone has access to the internet, so it's an equal playing field when it comes to fetching code to solve standard problems..

        yes, but you don't participate in rounds to copy solutions, it's okay to copy some block of code that will help you in solving the problem but not the solution itself! , so when I participate in a round i trust in cf that it will give me original problems so i depend on myself, others maybe will go to copy the answer so you will have 5k+ solutions so its not fair to those who trust cf.

        You can carry on and have fun with the remaining 5 problems in the contest instead of complaining

        for sorry not everyone can solve the whole problem set, if someone can only solve till c it will affect him if c was a googlable so i has the right to complain .

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

          Can you explain why can't we get any subsequence of the array? Or, at least, prefix + suffix? Why only subarrays?

          • »
            »
            »
            »
            »
            »
            10 месяцев назад, # ^ |
            Rev. 3   Проголосовать: нравится -21 Проголосовать: не нравится

            the operation given in problem, you can only take consecutive range then you can reduce it by deleting some range from it.

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

          As nifeshe implies, to me it is obvious you can get any subarray, but not so obvious you can't get any subsequence. Maybe for you it is, great, but it was not for many including me.

          It is sad that many can just happen to guess, but that is true of arguably most lower level problems.

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

          All of this frustration may be valid, but may I ask... Why are you complaining about a problem in a contest you didn't participate in?

          In fact, according to your profile you haven't made a submission in a contest in almost 6 months. I wonder what the fuss is all about.

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

            I mean if a problem is heavily disliked or liked one can have the curiosity to look at it

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

              Heavily disliked by whom? Steven-_-AbuAlkhair was one of the first to comment about the problem, right after the contest ended.

              Do you also go to the comments section to complain about how frustrated you are about the quality of specific problems, immediately after contests end? For contests you did not participate in? Really?

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

                Yeah since I didn't participated in contest I cant dislike a problem that's true :), leaving all that nothing was wrong about problem C, it was just a another easy div2 C, most frustration from people is due to others using online code while they didn't(either for being absent minded or they didn't want to)

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

                  most frustration from people is due to others using online code while they didn't

                  Again: how could they (the person who started this thread) be frustrated about others using online code to solve a problem in a contest that they did not participate in?

                  I'm done engaging here. Enjoy life.

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

    The link contains a solution that is not suitable for c

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

DEF -> FDE

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

Codechef Forces.. gave me the vibes of their contest

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

My approach for C was to calculate all suffix xor. Then answer will be maximum xor of any 2 suffix in an array. I don't understand how it is equal to maximum xor in a subarray. This is my solution btw — https://codeforces.com/contest/1847/submission/212410188

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

    Notice that the xor of 2 suffixes is equivalent to the xor of a subarray, example:

    Suffix xor 1 = a^b^c^d^e^f Suffix xor 2 = d^e^f

    Now if we xor these 2 we get a^b^c^d^e^f^d^e^f = a^b^c, notice how the intersection of the suffix xors get cancelled out. So when you calculate the xor for any 2 suffixes, you're actually just calculating the xor of every single subarray. Same with prefix xors.

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

Problem C likely had so many submissions because once you recognize that ans is max xor subarray you just have to google the solution. The max xor subarray problem is a great classical problem but I dont think such classical problems should be put in cf. How many people who submitted the solution knew how the solution works using tries I wonder. Not a good problem

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

    I did the trie part after thinking for like 15 minutes.

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

    I didn't solve the problem with max-xor-subarray.

    I didn't reach the this observation until you mentioned it. But still I managed to solve the problem.

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

Which anime was it?

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

im devastated after seeing subarrays.

To all 1400+. How to get 1400?

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

It is worth considering the fair treatment of individuals who made genuine attempts to solve problem C on their own, in contrast to those who only copy pasted the code from GFG.

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

Huge Jojo fan, but pretty bad contest

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

As a tester, I can say that the quality of the problems was very high. (especially C in my opinion)

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

How to solve D ?

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

    Lets do 2 key obsertvations. 1) If we have 2 segments that overlap, we can subtract the overlapping part with the segment with less "priority" in the calculation of t(s). Where the less the position is in t(s), the higher priority. So now lets recalculate the segments this way, and now each index belongs only to one "segment", even though they could now be not segments. 2) Now lets do a trick: lets calculate t(s) and instead do all of the operations on t(s). Now, because of observation 1 each element from s can be found exactly 1 time in t(s). Now lets do a segment tree for finding the sum on t(s) and to recalcing the answer is obvious: the numbers of 0s in the segment [0; x] where x is min(number_of_1_in_t(s), unified_length_of_all_segments)

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

      I did the priority distribution right, but couldn't come up with this idea that minimum operations is just number of zeroes that should've been 1. Thanks for your solution btw :)

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

Fun fact: C can be solved with O(nlog(max a[i])) complexity by using trie of prefix xor-sums.

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

trash round did the same thing as some of my friends in 1st 15 minutes and it TLE'd for me only so had to use a trie , just regretting i woke up for this cringey contest

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

Za Warudo toki wo tomare !!!

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

d

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

clown round, testers not doing their job properly, not even clown level this contest is the whole circus

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

A fun contest. But getting TLE 46 on D...... why me. But he solution was O(nlogn) so it should have gotten AC

EDIT WHAT I GOT AC NOW THEY CHANGED THE TL

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

Thanks for the 15 mins extension. I solved F in the last 3 mins (going back to master yeah). F is a really cool problem and I love it!

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

Finally, the cheaters were exposed this round. Thanks Youtube for wrong solution in problem C :D.

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

New to contests so this might be a dumb question but when will my rating update? At the moment I'm unrated but I solved a problem in this contest so I'm right to think I should receive a rating, right?

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

Me when FST on E

Edit: TLE on 68 because I forgor to remove a cerr that printed 2^16 arrays -_-

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

Literally the worst contest ever

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

    why?

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

      never saw these many bitwise questions in a single contest and apparently solution to C is available on the internet

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

        that doesnt mean round is bad plus u dont even need internet solution u can just do naive and check, no even need to think

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

          can u check my didnt my naive sol pass? also i mean the first submissiong BEFORE A

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

            delete long long, add fast i/o, idk about pragmas, i often dont trust them

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

        Fact is that if you have little variety of problems the contest is a little boring in my opinion

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

Maybe a little bit less bits problem next time XD

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

proof for problem C please, why we can't do better than max subarray?

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

    In XOR operation XORing the same number twice (or even number of times) negates it 1 ^ 1 ^ 2 = 2 so when Dio summons a stand user at index i, when he summons another stand user, stand users from i till the end will be negated so he can use this to negate numbers that lowers total XOR in the end of the array to negate the ones in the front he can just choose i to be equal to the element after them when summoning the last stand user for example if we have this array: 3 7 2 5 8 1 6 4 1 the maximum subarray xor answer is 15 which is 8 ^ 1 ^ 6 so he needs to git rid of 3 7 2 5 from the start and 4 1 from the end to get rid of the 4 1 he summons a new stand user with strength = 4 ^ 1 = 5 so now we have 3 7 2 5 8 1 6 4 1 5 to now summon the stronger stand user he can he need to negate 3 7 2 5, so he chooses i to be the index of 8 when summoning it so its strength is 8 ^ 1 ^ 6 ^ 4 ^ 1 ^ 5 and 4 ^ 1 ^ 5 = 0 so the strength is 8 ^ 1 ^ 6 = 15 which is the maximum XOR subarray

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

      thank you, but I already solved it by finding "maximum XOR subarray" in contest time, I mean why "maximum XOR subarray" will be the max answer which we can get, why answer can't be greater than "maximum XOR subarray" ?

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

        For each summon you only negate (or return already negated) numbers from the array, you don't add new number , so there is no way you can get an array with XOR larger than the maximum (It may be possible if you can add numbers from outside the array, but you can't) When you summon a user you its strength is equal to the XOR of the subarray which starts with i and ends with the end of the array to summon the strongest user you need to choose i that makes the XOR of subarray = to the maximum (i.e. the maximum has to be in the end of the array) if it's not in the end you summon a user that negates the users after the last user in the maximum subarray

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

    What can't be done with dp :D Nice solution btw

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

    Sad you had to copy from geeksforgeeks instead of dp

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

      During contest when I figured out the approach. I was pretty much sure there must be some implementation so I googled it and pasted that solution.

      And after the contest while having my dinner I also figured out that it can also be solved with dp

      BTW I solved problem A also with dp

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

    Nice solution using dp. I was unable to understand why maximum xor subarray works here, that thing is not intuitive to me. But seeing your dp solution, it helped me get that intuition!

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

    Could u please explain your dp solution. I am not able to understand ur dp states and transitions

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

      2^8=256 which is not large so we can find all the possibility using our array elements.

      Also our aim is to find maximum xorsum so we will update the maximum at each step.

      and also when we are visiting any index with some xorsum then we can surely say that we can find all the coming subsequences using xorsum from that index. So we will not visit that xorsum and index again as it will give the same output.

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

In c everyone just copies tries code form online, please check plagiarism.

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

sorry, who can tell me why wa? I generate permutation, where p[i] is priority of symbol in string. Next i compare sum on prefix and all '1'. this

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

Ratings updated preliminary, it will be recalculated after removing the cheaters.

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

I solved C by BFS. There are only 256 possible states to look for.

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

!

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

I found E quite interesting! (although the implementation is tough)

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

Why C was giving pretest 2 wrong when solved with Kadane's Algorithm

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

    Maybe because xor != sum... Interesting that you ask questions like this and you got AC with trie solution

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

When will be a tutorial? Or it won't?

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

contest bitmasks

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

Educational contest

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

I hope you accept my opinion with open arms, I think the title of the first problem is inappropriate to some people and i hope you change it, thanks in advance.

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

Can we approach B by doing binary search on answer,if yes how ? Thanks in advance

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

I've waited for 4 — No, 5000 years for this

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

In Problem A : In almost all submission they are sorting the differences then summing it untill

n-(k-1) but if we sort it will the contigious condition hold?

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

    Hi, we should divide the vecto a in k blocks such that the sum of blocks is minimum. So we must eliminate k-1 abs(ai-ai+1) that are maximum. So we calculate a vector of abs(ai — ai+1). After that we can ignore vector a. And sort it to eliminate the k-1 bigger values. Thanks. Rosklin

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

    no first we will calculate the diffrence like (i-i+1) ,(i+1-i+2)..... and after getting the diffrence we will sort the array

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

I was trying F by offlining the queries and divide and conquer during contest but couldn't finish implementation. I made the following observations:

  1. If there exists some x in the infinite sequence then it must be the bitwise or of some subarray of the given array (consider the given array to be circular in mind).

  2. Or value of smaller subsegments appear first.

  3. So for each query we can binary search the length l of smallest interval s.t. there exists a subarray of length l (if its start point lies on or before n — l + 1, otherwise length l + 1 i.e. OR[start][n] | OR[1][l + 1 — (n — start + 1)]) whose bitwise OR value is > given query but unfortunately, this is too slow (O(nlog(n))

  4. So instead of answering them online we can offline them so that we do the binary search thing for multiple queries at the same time.

  5. Thus we use divide and conquer where we essentially do binary search on min length of such an interval. If among all the subarray of length mid, the max possible or value is x then all queries with value < x must recurse left (< x) and rest on right (> x)

  6. Since for all elements recursing to the left, x is also an option, we update their ans.

However, I am getting WA on test 3 with this approach. And I cannot figure out where I am wrong. Any suggestions would be helpful. Thanks in advance. My submission

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

why data structure set get tle in problem C 212459176 and unordered_map is accepted 212486902 and i just use it in small range from 0 to 2^8 it should be bigo with set equal to (n*(2^8)*log(2^8)) as max complexity and in unordered_map will be just (n*(2^8)) is this big different or i just calculate it wrong

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

In problem b the #pretest 2 is n=2; 1,1; so minimum we can generate is 1; and we can divide them into 2 groups to generate 1 from both the groups but pretest 2 says ans should be 1 only please help help help!!!

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

    The case 1 1 if we divide into 2 groups will be (1) and (1), the sum is (1) + (1) = 2, while keep them in 1 group will have the sum 1 & 1 = 1 which is smaller.

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

CHEATFORCES!

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

In problem D, i misunderstand the statement and ended up trying to solve a different version of it.

Here it is :
In this version we do operation on t instead of s and try to make t as lexicographically as large as possible. i don't know if it is solvable with dependent queries or not.

But it can be solved if queries were independent.

we can calculate number of ones after each update and sort it in non decreasing order and go from left to right. Let's say length is $$$len$$$ than we need to compute some prefix of segments such that it's total size if equal to our $$$len$$$ and we update these segments in segment tree as $$$seg[l]$$$++ and $$$seg[r + 1]$$$-- and now for our query we can easily calculate number of ones in our $$$len$$$ range and can get result for current query. We than go right and again push our pointer ahead in our ranges as mentioned above and do same thing again. Here we don't need to start again from 0 as we have sorted length (number of ones after update) of each query and we can continue after we stopped last time and do same.

But if queries were dependent as in problem d it is, than how to solve it ?
note that in this version we are updating t instead of s.

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

for problem f:

i am thinking that we will first find an array say maxs(n), where

maxs(i) = maximum bitwise or of i consecutive elements then we can do binary search and get suitable minimum i where maxs(i) > v, and then for that particular i we can again do some binary search or something to find exact position.

but here i am not able to find maxs(n) in less than o(n^2), could some one please give some hints regarding that.

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

Absolutely, F is greatly easier than E.

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

Please Bring Editorial :/

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

Interesting round,but with too mamy bitwise operation problem XD

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

I can do A and B but not C. Thank you for this problem, I found it interesting while studying for how to solve it and I learned something new.

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

I am newbie and I solved one problem but I have been not rated yet ??

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

in problem C, why using unoredred_map to store count gives tle on t.c 2, isn't unoredered map works in O(1) ??? https://codeforces.com/contest/1847/submission/212935082

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

Comment # 299

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

Comment # 300

Yahhh! We got 300 comments.

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

В вашем соревновании был обнаружен ДжоДжо референс. Теперь оно переходит под наблюдение Фонда Спидвагона.

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

super members!!

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

Hey codeforces, my solution to problem B has been considered as violation of rules, but I have absolutely no idea how it happened. I never used any unfair means. Please look it the matter.

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

Apologies for the necroposting as I often do.

Consider a harder version of problem D, where instead of any i<j, we are allowed only to swap adjacent elements, so swapping s[i] and s[j] would take (j-i) cost.

Any ideas on how to solve this version of the problem if we were to print the minimum cost after each query?

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

I can not understand the third output in problem C. Can someone help me pls :(

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