atcoder_official's blog

By atcoder_official, history, 2 years ago, In English

We will hold HUAWEI Programming Contest 2024(AtCoder Beginner Contest 342).

We are looking forward to your participation!

  • Vote: I like it
  • +104
  • Vote: I do not like it

| Write comment?
»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

A round with prizes,NICE.

»
2 years ago, hide # |
 
Vote: I like it +29 Vote: I do not like it

HUAWEI Round. Excited.

»
2 years ago, hide # |
 
Vote: I like it +23 Vote: I do not like it

tourist register and he will get more money

»
2 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

omg HUAWEI round

»
2 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

omg this is the first time that I see a video in the contest description!

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

excited

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

F<<<E!!!

  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it +61 Vote: I do not like it

    Really? I felt like E was just "yeah this is your standard ABC dijkstra problem, enjoy implementing for 10-15 mins :)" while F actually required some rough thinking.

    • »
      »
      »
      2 years ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      I observed that, but what's next?

      • »
        »
        »
        »
        2 years ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        start with n-1 storing val-c in priority queue to next node where val=current node max value.

        code
  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    How did you do for F ?

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I think D was two pointer problem.Am i right?

»
2 years ago, hide # |
 
Vote: I like it -16 Vote: I do not like it

G is easier that D :)

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

For F: I was able to find out the probability of achieving $$$x = x_0$$$ and the winning probability when $$$x = x_0$$$. Using this info, how do I determine the answer.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can anyone provide me edge case for my solution for Problem D Link

Approach: Precompute all the squares till 2e5 and check by dividing that if good pair exists or not.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can someone explain F?

  • »
    »
    2 years ago, hide # ^ |
    Rev. 2  
    Vote: I like it +10 Vote: I do not like it

    First compute the probability that dealer gets at least $$$x$$$ points linearly. Then do dynamic programming over $$$dp[x]$$$ = probability that you win if you start with $$$x$$$ points.

    https://atcoder.jp/contests/abc342/submissions/50612581

  • »
    »
    2 years ago, hide # ^ |
    Rev. 8  
    Vote: I like it +21 Vote: I do not like it

    For the dealer we can simulate the probabilities of them having a particular sum at the end since they have a fixed move for a given sum.

    Pseudocode

    Now for the player, if we stop at a specific score $$$x$$$, we know the probability of winning is $$$\text{player_probability[x]} = 1 - \sum_{i = x}^{n}{\text{dealer_probability[i]}}$$$. However, we can also decide to continue playing, in which case it becomes the average probability among all possible dice rolls, i.e, $$$\frac{\sum_{i = x + 1}^{\text{min(x + d, n)}}{\text{player_probability[i]}}}{d}$$$, so we take the max of these two values. Doing this in decreasing order of $$$x$$$ gives us a way to calculate the probability for all scores.

    Pseudocode

    Then player_probability[0] is the value you want. To speed this up from $$$O(n ^ 2)$$$ to $$$O(n)$$$, use difference arrays and prefix sums to get rid of the inner loops in both of the above parts.

    • »
      »
      »
      2 years ago, hide # ^ |
       
      Vote: I like it +5 Vote: I do not like it

      Thank you,this explanation is beautiful.

      I think $$$\sum_{i = x+1}^{min(x+d,n)}\frac{player_pprobability[i]}{n}$$$ should be replaced by $$$\sum_{i = x+1}^{min(x+d,n)}\frac{player_pprobability[i]}{d}$$$ .

»
2 years ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

How are the rating updates for the ABC calculated if there are so many participants whose ratings are outside the rated range? I mean, they are still considered in the ranking list, aren't they? Wouldn't it be unfair to calculate the rating changes based on the rank each time, as sometimes there are stronger competitors?

»
2 years ago, hide # |
Rev. 2  
Vote: I like it +6 Vote: I do not like it

Is it just me who overcomplicated the solution of problem C with small-to-large merging xD? Submission

»
2 years ago, hide # |
 
Vote: I like it +32 Vote: I do not like it

90% of E is figuring out what the statement is trying to say 🤡

»
2 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

https://atcoder.jp/contests/abc342/submissions/50599311

can anyone tell me what is wrong in this code? Any help would be appreciated

  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it -10 Vote: I do not like it

    Consider this input:

    Input

    Your code gives dtcovvr as output. However, d is supposed to be replaced by v. Why do we still see d in the output?

»
2 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

btw in D if we factorize all numbers, we will know if the product of two num is squared, if only after adding their factors there is even numbers of factors right? 3 -> 3 and 12 -> 2,2,3 so 2,2,3,3

but how we can find all such pairs?

  • »
    »
    2 years ago, hide # ^ |
    Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    You can find square-free part of number (make sure to handle zeros separately). In particular, the square-free parts of both numbers must be equal. Or, you can do something similar to what is done in 1225D - Power Products, where you ignore zeros, and check the rest (there are only $$$\mathcal{O}(\log 10^5)$$$ prime factors for each number).

»
2 years ago, hide # |
 
Vote: I like it +12 Vote: I do not like it

To help you build intuition for F and lead you to the solution in a more natural manner, I've created an easy version $$$O(n^3)$$$ and $$$O(n^2)$$$ which focuses on the probability + DP part (instead of optimization). It also asks you to print each intermediate DP values, since debugging probability problems can be tricky. I also added some followup problems to test your understanding.

You can find the contest here: https://mirror.codeforces.com/group/7Dn3ObOpau/contest/506759

The problems are untested. If you see any issues, please let me know.

»
2 years ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

difficulty: G < E < F

I solved ABCDG(

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Admin please conduct contests on both Saturday and Sunday

»
2 years ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

The solution to G https://atcoder.jp/contests/abc342/submissions/50593706 is hacked by:
1
1
4
1 1 1 2
1 1 1 2
2 1
3 1

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

when the prize will be awarded :)