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

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

We will hold AtCoder Beginner Contest 258.

The point values will be 100-200-300-400-500-500-600-600. We are looking forward to your participation!

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

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

G is a well-known problem, see https://youtu.be/BJhzd_VG61k?t=3841

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

Atcoder Implementation contest :/

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

LoL dude I took a class Big Data Processing and learned counting triangles this spring semester.

And I solved G today.

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

G can be solved using bitset

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

Thanks for the contest, Problem E was great :) even couldn't solve it in the contest due to a small bug in my code but I enjoyed solving it :)

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

What is the observation or logic behind problem F? I even don't know how to start the first step to analyze this problem :(

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

Is there a solution to G — Triangle without using bitset?

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

For problem G — Triangle. I was trying to solve it using bitset.

Can any one explain why Code 1 is giving correct output while code 2 is giving wrong output?

Code 1
Code 2

PS:- Found the mistake. In code 2 I need to reverse the string before converting it to bitset.

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

Anybody can help me with the B problem. I couldn't figure it out till the end.

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

Can somebody tell what is the approach used in E to find the k th box's weight

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

    In E we need to observe that the potato sizes $$$w[]$$$ define a linked list, where each element points to the first potato of the next box. Find the number of each box by binary searh in $$$O(logn)$$$

    With this linked list, the problem asks basically for the $$$(K-1)$$$-th successor of the first element. This can be solved by binary lifting

    An alternative solution instead of binary lifting can also be construct. We see that starting from first element the linked list leads into a circle at some time. So, there is kind of a tail of size $$$y$$$ leading into a circle of size $$$x$$$.

    If $$$K \lt =y$$$ then answer is the K-th vertex in the tail, else it is the $$$((K-y)\%x)$$$-th vertex of the circle.

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

Will the test cases for recent abc's not get added to the dropbox?

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

How to solve H?

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

    Firstly, lets think about the corner case: $$$N = 0$$$.
    We need to split $$$S$$$ into odd terms. Define $$$f(n)$$$ — number of "odd" splits of n.
    We can calculate $$$f(n)$$$ using DP (fix first term):

    $$$ f(n)=f(n-1)+f(n-3)+\ldots $$$
    $$$ f(n-2) = f(n-3)+f(n-5) + \ldots $$$
    $$$ \Rightarrow f(n)=f(n-1)+f(n-2) $$$

    Ok, these are just Fibonacci numbers, we can calculate them using the standard matrice approach in $$$O(\log X)$$$.

    Now, we can image this problem as in the picture below:

    We need to select a few available positions of prefix sums for our array (maybe 0) and make sure that the difference of the neighboring ones (these are exactly the elements of the array) is odd.

    Firstly, insert $$$0$$$ and $$$X$$$ into $$$A$$$.
    We can calculate $$$dp[i][j]$$$ — number of ways to select free positions $$$0 \lt p_1 \lt p_2 \lt \ldots \lt p_k \lt A_i$$$ and
    1. $$$p_i - p_{i-1} \equiv 1 \mod 2 $$$
    2. $$$A_i - p_k \equiv j \mod 2$$$.
    Then, $$$dp[N][1]$$$ is answer.

    To recalculate $$$dp[i+1]$$$, in fact, we need to solve this task with $$$N=0$$$. This is quite simple to do using the comments above. It may be necessary to consider several cases, but they are essentially the same.

    Sample code

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

Hey can someone help me out with problem E, I am not able to understand where I am going wrong, this is my Submission, any counter case will also help.