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

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

We will hold AtCoder Beginner Contest 403.

We are looking forward to your participation!

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

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

one step closer to Round 404

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

Why unusual day?

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

why on Sunday?

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

My first time to take part in Sunday ABC.

No... I didn't solve G because I didn't use pushup...

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

Why is the contest on Sunday? The one day I get off and want to play with my friends and you keep a contest in the evening :(

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

I have a May Day holiday adjustment, and have to go to school on Sunday, why not on Saturday?? :(

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

Huh?tomorrow?just rushed home to participate

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

Hello, AtCoder! I think Codeforces competitions are no longer suitable for me. Therefore, I registered an AtCoder account named zhoujiarun, and I'm going to start challenging the ABC contests! I'll begin by aiming for my first AK (all problems solved) in an ABC contest.

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

Will the submission during the competition also undergo tedious human-machine verification?

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

The worst ABC

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

G could also be solved in $$$O(q \sqrt{q})$$$

Submission

»
19 месяцев назад, скрыть # |
← Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится
D sub

Why does this DSU + DP solution on D not work ?

What I am doing is creating chains of AP

1->3->5->7->9->11..

2->4->6..

etc

Then we want to remove elements from these chains such that adjacent elements in chain have to be deleted. We use dp to find minimum elements to remove per chain.

It gives WA on 5 TCs

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

Just a suggestion regarding the type of problems in ABCs. Of course, ABCs are meant to be educational, but that doesn't mean they need to have problems with no observations. What about including standard problems that also involve standard observations (maybe some common invariant, mathematical property, etc.)? I think most people are weaker at observation-based problems and would love to get better at them. Such problems are also more fun to solve, unlike problems like E today. I would love to see one or two standard/educational observation-based or constructive problems per contest in future ABCs, if possible.

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

For D, can someone help point out a case where this is wrong?

So basically I formed an array of frequencies of numbers that are in a chain (for example, if $$$D=3$$$ and the array is $$$\text{1 1 1 4 7 13 13 16 7 7}$$$, I have two arrays: $$$\text{3 1 3}$$$ (for $$$\text{1 4 7}$$$) and $$$\text{2 1}$$$ (for $$$\text{13 16}$$$). Then, for each array $$$l$$$, I used this dp formula: $$$dp[i]=\text{min}(l[i]+dp[i+1],\ l[i+1]+dp[i+2])$$$. At each step $$$i$$$ either I keep $$$l[i]$$$ and thus have to delete $$$l[i+1]$$$, then proceed with $$$l[i+2:]$$$, or I delete $$$l[i]$$$ and proceed with $$$l[i+1:]$$$. I handled $$$D=0$$$ separately and still got 6 WAs.

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

    after you form those, there is a greedy which works. for each $$$ i, 2 \lt = i \lt = |chain| $$$ add $$$chain_{i - 1}$$$ and $$$ chain_i $$$ $$$ min(freq_{chain_{i - 1}}, freq_{chain_i}) $$$ times in the resultant array. Let $$$ p $$$ be a collection of only uniques in that chain. Let $$$ newFreq_j $$$ be the total frequency of $$$ j $$$ in the chain. Then answer is sum of $$$ newFreq_{chain_i} $$$ for all even indices (1-based)

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

I was trying to solve D without DP. what is the issue with below code

https://atcoder.jp/contests/abc403/submissions/65293401

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

    Your code fails on the following case (the answer is 2 but your code gives 3):

    6 1
    1 1 2 3 4 4 
    

    it seems that only taking the odd or even is not always optimal

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

      I don't know the specific logic of his code but a greedy works by only picking elements at even indices. My submission

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

        can you please explain your approach in details?

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

          Idk if I'll be able to explain properly but I'll try my best. I'll reply in some time.

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

            ok waiting

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

              while explaining I'll be using $$$d = 1$$$, $$$a = [1, 3, 4, 4, 5, 5, 5, 8, 9, 13, 20]$$$. Also denote the frequency of $$$ith$$$ element as $$$f_i$$$.

              Observation 1:

              • We don't need those elements which don't affect us i.e. in the original if there is some $$$i$$$ such that there exists no $$$ j $$$ such that $$$ |a_i - a_j| = d $$$ then we don't need to worry about that.

              Observation 2:

              • If there's some $$$ a_i $$$ and $$$ a_j $$$ such that $$$ a_i - a_j = d $$$ (for the sake of simplicity, consider the array sorted and $$$ j \lt i $$$) then how many of the occurrences do we need to remove to make the array good?
              We need...

              READ THE SPOILER!

              Let $$$ x = min(f_{a_i}, f_{a_j}) $$$ then our frequency gets updated to $$$f_{a_i} - x$$$ and $$$f_{a_j} - x$$$. We keep going and going. Now, I'm going to simulate this process for the array we took as an example:

              (Sort the array)

              I'll call the resultant array with only required elements as $$$ c $$$ and the frequency of the $$$ i$$$ in $$$ c $$$ to be $$$ o_i $$$. JUST A QUICK NOTE: Make sure that $$$a$$$ only has unique elements when processing, and our $$$c$$$ will also only have unique elements.

              $$$ a $$$ with unique elements = $$$ [1, 3, 4, 5, 8, 9, 13, 20] $$$.

              1. at $$$ i = 0 $$$ the required element $$$ 1 - 1 = 0 $$$ doesn't exist so we continue.

              2. the same is true for $$$ i = 1 $$$ so we continue again.

              3. at $$$ i = 2 $$$, our required element $$$ 4 - 1 = 3 $$$ exists. Time to compute our $$$x$$$ which would be $$$min(f_3, f_4)$$$ and it turns out be 1. Update the frequencies of $$$3$$$ and $$$4$$$ in $$$c$$$ to $$$1$$$ and add them in $$$c$$$. also decrease the frequencies $$$f_i$$$ for them. $$$f_4$$$ becomes 1 (decreasing $$$f_3$$$ isn't really required).

              4. now at $$$ i = 3 $$$ we have $$$x = min(f_4, f_5) = \gt 1$$$. its because $$$f_4$$$ decreased to 1 in previous step. so update the frequencies in $$$c$$$ again.

              Continue this process for each element, you will get $$$c = [3, 4, 5, 8, 9]$$$ with frequencies as follows:

              $$$o_3 = 1$$$

              $$$o_4 = 2$$$

              $$$o_5 = 1$$$

              $$$o_8 = 1$$$

              $$$o_9 = 1$$$

              Observation 3:

              • Note that we don't need to remove $$$3$$$ and $$$5$$$ in the block $$$[3, 4, 5]$$$. instead, removing both $$$4s$$$ work. why? Well, I don't have a solid proof. I asked chat gpt to prove it after the contest and here's what it gave (Link). Now, i'm going to explain what my thought process was during the contest. If you look closely then you notice that $$$o_4 = o_3 + o_5 $$$ and that is true for every middle element of the form $$$ [x - d, x, x + d] $$$ so instead of removing left and right elements, we remove middle elements and out of that I came to conclusion that it is optimal to remove the elements at odd positions (0-based indexing). By removing, I mean removal equals their new frequency $$$o_i$$$.

              So after making the array $$$ c $$$, just separate it into blocks of the form $$$ [x, x + d, x + 2d, ...] $$$ and iterate over odd positions (0-based) and add their frequencies to answer.

              I tried my best. If there's any confusion, feel free to ask.

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

Are the CP gods with me for this submission?

https://atcoder.jp/contests/abc403/submissions/65298809

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

I use hash to solve the problem E, but the data stuck my modulus. I even use the double hash to get AC.

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

So many cheaters. Examples:

As you are aware, when cheating occurs in rated contests, it unfairly alters the standings and consequently impacts the rating changes of honest participants. Honest players may suffer unjust rating losses or smaller gains because cheaters artificially occupy higher positions on the leaderboard. This undermines both the fairness of the competition and the credibility of the rating system.

atcoder_official, I kindly ask you to investigate these submissions. If any violations are confirmed, I would respectfully request that appropriate actions be taken, such as disqualifying the offender and adjusting the ratings of affected participants, if possible.

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

why problem D can't apply binary search and greedy to solve? To every distinct element in the A,then find a sequence that has a diiference of D ,and choose the less number between the number of odd index and even index. Got WA in 15 testcases(.