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

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

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
  • Проголосовать: не нравится

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

Finally a contest after almost a week!

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

I went nowhere and did based testing.

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

I went to Antarctica and did kinesthetic testing.

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

I went to Narnia and did soulful testing.

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

--Deleted--

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

Is one of the problem named Treelike?

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

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

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

Is one of the anime Vinland saga?

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

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

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

Finally I'm going to be rated!!

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

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

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

Let me guess, is the anime Horimiya?

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

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

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

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

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

I went to Alaska and did master level testing.

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

Atekichan Finally your time to shine!!

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

i have a bad feeling about this round...

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

Enjoy every competition

»
3 года назад, скрыть # |
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 .

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

I went to Antartica and did gawky testing.

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

Is anyone left for taking part in the contest?

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

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

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

score distribution when?

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

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

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

Indian setters and testers means contest with bits questions :)

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

Its time to purple again :)

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

Hope to get to CM!

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

Balanced score distribution

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

I will become specialist :)

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

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

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

Huge gap from D to E. Interesting!

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

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

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

excited to participate!

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

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

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

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

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

W Contest

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

there are few bitwise operations today thx

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

Bitwiseforces

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

this contest very very very hard

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

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

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

GFGforces

»
3 года назад, скрыть # |
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?

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

LtoR forces bitwiseForces SpeedForces jojoforces

»
3 года назад, скрыть # |
 
Проголосовать: нравится +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?

»
3 года назад, скрыть # |
 
Проголосовать: нравится +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?

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

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

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

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

»
3 года назад, скрыть # |
 
Проголосовать: нравится 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.

»
3 года назад, скрыть # |
 
Проголосовать: нравится 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.

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

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

»
3 года назад, скрыть # |
 
Проголосовать: нравится +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.

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

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

»
3 года назад, скрыть # |
 
Проголосовать: нравится +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.

»
3 года назад, скрыть # |
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:)

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

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

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

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

  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится +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?

  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится +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.

  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится +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?

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

Any good hints to solve F?

»
3 года назад, скрыть # |
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.

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

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

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

Try to make beautiful problems not a beautiful blog.

»
3 года назад, скрыть # |
 
Проголосовать: нравится +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))))))))))))

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

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

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

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

»
3 года назад, скрыть # |
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
»
3 года назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Anyone else overkilled problem A with dp?

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

No written editorial?

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

hmm

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

Just not my day I guess. .

  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится 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 "&".

    • »
      »
      »
      3 года назад, скрыть # ^ |
       
      Проголосовать: нравится 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

    • »
      »
      »
      3 года назад, скрыть # ^ |
       
      Проголосовать: нравится 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.

    • »
      »
      »
      3 года назад, скрыть # ^ |
      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

»
3 года назад, скрыть # |
Rev. 4  
Проголосовать: нравится -81 Проголосовать: не нравится
  • »
    »
    3 года назад, скрыть # ^ |
    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.

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

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

  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится -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.

    • »
      »
      »
      3 года назад, скрыть # ^ |
       
      Проголосовать: нравится +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.

      • »
        »
        »
        »
        3 года назад, скрыть # ^ |
         
        Проголосовать: нравится 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

      • »
        »
        »
        »
        3 года назад, скрыть # ^ |
         
        Проголосовать: нравится 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 .

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

DEF -> FDE

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

Codechef Forces.. gave me the vibes of their contest

»
3 года назад, скрыть # |
 
Проголосовать: нравится 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://mirror.codeforces.com/contest/1847/submission/212410188

»
3 года назад, скрыть # |
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

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

Which anime was it?

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

Huge Jojo fan, but pretty bad contest

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

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

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

How to solve D ?

  • »
    »
    3 года назад, скрыть # ^ |
     
    Проголосовать: нравится +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)

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

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

»
3 года назад, скрыть # |
 
Проголосовать: нравится -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

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

Za Warudo toki wo tomare !!!

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

d

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

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

»
3 года назад, скрыть # |
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

»
3 года назад, скрыть # |
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!

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

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

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

Me when FST on E

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

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

Literally the worst contest ever

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

Maybe a little bit less bits problem next time XD

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

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

  • »
    »
    3 года назад, скрыть # ^ |
    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

    • »
      »
      »
      3 года назад, скрыть # ^ |
       
      Проголосовать: нравится +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" ?

      • »
        »
        »
        »
        3 года назад, скрыть # ^ |
         
        Проголосовать: нравится 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

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

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

»
3 года назад, скрыть # |
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

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

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

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

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

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

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

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

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

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

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

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

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

»
3 года назад, скрыть # |
 
Проголосовать: нравится 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

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

CHEATFORCES!

»
3 года назад, скрыть # |
 
Проголосовать: нравится 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.

»
3 года назад, скрыть # |
 
Проголосовать: нравится 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.

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

Absolutely, F is greatly easier than E.

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

Please Bring Editorial :/

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

Interesting round,but with too mamy bitwise operation problem XD

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

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

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

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

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