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

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

i might have to quit codeforces after this

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

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

Auto comment: topic has been updated by TsPcZc (previous revision, new revision, compare).

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

Auto comment: topic has been updated by TsPcZc (previous revision, new revision, compare).

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

Auto comment: topic has been updated by TsPcZc (previous revision, new revision, compare).

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

You can upload img there, then open the link, click on your image RMB, click "Copy URL of pic", and on codeforces in the text section select img button the left side of 'chain' icon. Paste link there, done

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

Auto comment: topic has been updated by TsPcZc (previous revision, new revision, compare).

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

Auto comment: topic has been updated by TsPcZc (previous revision, new revision, compare).

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

If you made the same mistake as me, you might be failing testcases like $$$[2, 1, 3, 1]$$$ for $$$E$$$. If we blindly assign some element that isn't equal to the last two (unique) elements to the end of this array, we could end up with something like $$$[2, 1, 3, 1, 2, 3, 1]$$$ which creates the extra palindrome $$$a[1..5]$$$.

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

    oh nah in those cases I always add an element that doesnt appear first

    only then do i add elements that arent at the end of the array (if there are no more unique elements)

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

Could not agree more

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

I took a look at your D and you got the idea (more or less) lol

Try to think about it as:

Spoiler

Anyway by printing endl the stream it's flushed; you do not need an explict call to cout.flush() afterwards.

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

    Well, I couldn't appear in the contest due to some issues but, while overlooking, I came up with the following approach for D:

    1) Find the range r — l, with 2 queries. Sum of original array. Sun of updated array. 2) Now, use queries to find the start element. Like Binary Search. 3) First half of array. If the difference equals range, the range is in first half else, it's in second half, if difference is zero. 4) If difference is less than range but more than zero, you have stumbled upon one of the modified element. Now, use sliding window of range length to find l and r.

    Do you think, this works?

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

      To be clear i think you are letting the things to be harder than it's meant to be lol.

      By following you reasoning you got the special case where the modified range it's one of those that falls right into the range that we are querying. So i'll exclude this case from futher discussions.

      Lets define $$$k$$$ as the size of the range that we are looking for (obtained by querying the entire range and subtracting the modified one with the original).

      At some point you got a range $$$[l, r]$$$ that has some elements modified; that implies that the entire needed range falls in the range $$$[l - k + 1, r + k -1]$$$.

      As you can see, now by doing a sliding window technique, you have to make one query for each subarray of size $$$k$$$. I think it's pretty clear that you will surpass the limit of the $$$40$$$ query aviable.

      Maybe you get do some trick like to query only non overlapping subarray but i'll let you figure it out why it's not going to work.

      In the spoiler of my first comment there is the solution that's easy to get.

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

        Actually, no we don't need to iterate the sliding window entirely.

        1) Suppose we find a modified element at n.
        2) Check the difference of the modified array and original array between range (n-k) and n. Let this be m.
        3) Now, the first index would simply be n — m.

        This way, we can save on the queries :)

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

Bruhh sameeee.

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

I am just bad at reading problems(

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

was my worst ever contest div 3 contest y was it so hard?

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

Is it just i am good or is it skill issue

E stumped me for 1.75 hours :((

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

well,well,well what about mee???

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

lol

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

For div3/B your code is way too much . Looks like you are doing a PHD in strings.

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

There was just a tiny swaping opeartion nothing else in the problem E! That got me whole contest to find!!!

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

Test your code locally before submitting

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

in B u can just print index of all 0's or all 1's

in D observe that if u subtract 2nd query from 1st query result for some range u would get number of elements which are increased, now binary search for largest l such that no values are increased in this, print l+1 and l+1+total increased value

in E I first find 3 unique elements which aren't present in array a, if I couldn't find I just fill my array with unique elements from backward and reverse it, now print it ans[i%3] for all i from 0 to k

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

i see the mamba in you, ask for the ball more

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

It's very sad to say