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

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

We will hold AtCoder Beginner Contest 441 (Promotion of Engineer Guild Fes).

We are looking forward to your participation!

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

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

front row

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

Hope to solve A ~ F.

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

HI

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

Good luck

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

Here I am again.

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

hi and good luck

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

Good luck everyone!

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

How G?

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

Nice contest! How to G? Seems like just some segment tree with good merging and lazy updates, but the order seems tricky: if we have a lazy "flip+set to 0", and a lazy "add x", not clear what to do first. Is there a common pattern for this, like storing the timestamp of the lazy operation?

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

    Alternate approach is sqrt decomposition on queries. To solve a block of queries I split the array into segments so that each query either affects the whole segment or no element from it (coordinate compression). For compressed values I store the number of 1's and the maximum value. To rebuild the array after the block of queries there are 2 cases: either the block wasn't covered by second type or it was. All in all the solution works in something like $$$O((n + q) \sqrt q)$$$

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

    When pushing down flips, zero out lazy adds (those adds would no longer matter anyway since the flip sets everything in the segment to 0) . Now if a node has both a lazy flip and add, the add had to come after the flip

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

    You can try solving this first: CSES 1735

    Note that today's query 2 can be redefined as "set all $$$[L,R]$$$ to 0, flip all $$$[L,R]$$$". This is exactly the CSES problem, just with an added "flip" state.

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

    I did with sqrt decom, had to maintain flip , max , sum and count tag

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

How to solve C and E ??

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

please translate editorial in English

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

bubbles...... o o ~~~~~~~~~~~ o --- /|\

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

For problem C

I sorted the array and initiliased the ans = n-k

then for looped from 0 to k-1'th index and subtracted a[i] from x and incremented ans by +1. the moment (x<=0) I breaked out of loop.

I saw similar solutions from people but it got accepted can someone help me here. My solution link : Wrong answer link Thanks.

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

    The worst case is the one taking first all the cups with water, hence starting with n-k as you said.

    Then you have k cups left (the ones with sake), for this part it will be better to take the ones with more quantity first, not the one with less.

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

      Edited : Got it Thanks a Lot.

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

      Why do we take the one with more quantity first instead of the lesser one?

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

        Suppose that you have n cups and all of them contain sake (there are no cups with water), the minimum amount of cups to get at least X ml of sake will be sorting non-increasingly and taking every cup from the beginning to the end until we reach X.

        Now, suppose that we have n — 1 cups with sake and 1 with water, let's proceed similarly as the previous case (sorting and taking every cup from left to right). Let's analyze all possible scenarios:

        1 — We get lucky and we reach X before getting the cup with water -> let t1 the cups drank when we reach X ml of sake

        2 — We get unlucky and we find the cup with water before reaching X -> let t2 the cups drank when we reach X ml of sake

        3 — We get really unlucky and the first cup (with biggest amount of liquid) is water -> let t3 the cups drank when we reach X ml of sake

        Notice that t1 <= t2 <= t3

        in the problem we don't know where are the cups, so the worst case is where we get as unlucky as possible and the cups with biggest contribution (ml) contain water,

        if that's the case in the original problem when we have exactly k cups with sake and n — k cups with water, you can remove the biggest n — k cups which will be the worst case (biggest n — k cups contain water) and the problem gets reduced to find the minimum number of cups that we need to take to reach at least X ml of sake between k cups of sake, so we can proceed as in the first paragraph.

        Disclaimer: This is just my intuition, it's not a formal proof

        Alternatively, you can analize the following test case:

        Input:
        3 2 5
        10 4 8

        Output:
        2

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

谁懂啊,AT Rating 383差一点就到棕名了

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

How to F?

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

    You can do a knapsack from 1 to n as pre,and another from n to 1 as suf. if without the i-th item, the total value will be less than the best total value, it will be A.else if with the i-th item,the total value will not be less than the best total value, it will be B,else it will be C. To caculate the total value without i-th item, find the max in j from 1~m, pre[i — 1][j]+suf[i+1][m-j]. To caculate the total value with i-th item,find the max in j from 1~m-p[i], dp[i — 1][j] + suf[i + 1][m — p[i] — j] + v[i]. My Submiitiion: https://atcoder.jp/contests/abc441/submissions/72561689

    My English isn't good, i'm sorry for that:|

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

Actually preblem F can be solve by bitset in $$$O(\frac{n^2m}{w} )$$$,which $$$w=64$$$.To be more specific,we set two bitset $$$A,B$$$ in order to record what item must/can be chosen and merge them in the dynamic programming in $$$O(\frac{n}{w})$$$ per merge.

One possible version:this submission.

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

Where can I find more problems like G?

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

why no editorial till problem C How to appraoch problem C..? i am completely blank :(

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

can someone help me finding the TC where this code fails in problem G?

its getting passed in 13TCs out of 58TCs

https://atcoder.jp/contests/abc441/submissions/72584160