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

Автор rng_58, история, 10 лет назад, По-английски

AtCoder Grand Contest 001 will start soon (time).

Note that you need to click the blue button here to register.

Let's discuss problems after the contest.

The contest duration is changed to 110 minutes.

The contest has finished. How was the contest?

Congratulations to cgy4ever for winning!

Editorial: https://agc001.contest.atcoder.jp/data/agc/001/editorial.pdf (English is at the bottom)

UPD: The rating is updated.

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

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

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

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

sorry i can't find the blue button to register!

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

It'd be nice if there was a countdown counter for the nearest upcoming contest somewhere on the main page of the contest, then, one shouldn't worry about missing the contest

Thank you :D

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

How does the contest difficulty compare to a codeforces div1 or div2 regular round?

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

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

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

Can I view leaderboard without logging in/registering?

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

Awesome Contest !! Btw, how to solve C ?

EDIT: Super Fast Editorial Thanks!

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

    After all there will be a center of a tree. It will be vertex or middle of an edge. Let's try all possibilities and calc distances from center to all vertices (using BFS). We have to delete all vertices with distance greater than k / 2. It is O(n2).

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

      I tried to solve C . But I can't solve it . My approach was :

      First I tried find out the any Two Farthest Distant node (Let's say U & V ) using BFS.

      Then I ran a BFS and find the distances of other Nodes from U. If any Node's distance is greater than K count those Nodes.

      Again I ran a BFS and find the distances of other Nodes from V. If any Node's distance is greater than K count those Nodes.

      Then I printed the minimum of Both counter . Can you please say where am I getting error ? Here is my Code : http://agc001.contest.atcoder.jp/submissions/809066

      Thanks in advance .

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

    I had an alternative solution for C.

    Let's root the tree anywhere. Define the height of the leaf as 1 and the height of the empty tree as 0. Also, since the tree has to be connected at the end, we can only remove from leaves upwards. Now calculate the following DP.

    a[i][j] — the minimum number of nodes that we need to remove from the subtree i, such that the height of the tree is exactly j and the diameter of the resulting subtree will be at most K. Let s denote the son of i.

    (equals to the amount of nodes in the subtree)

    The idea is that if we want a height j, then we pick one deepest son, which will give us height j - 1, and then the rest of the children need to be both not deeper and not give a diameter bigger than K in combination with the deepest son. We can precompute the inside minimum as prefix array and do the whole computation efficiently.

    Finally, we need to accommodate for the fact that we have picked the root randomly. This means that for any subtree we can now decide to remove the rest of the nodes, not belonging to this subtree.

    Here is my code.

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

    People already explained the smart way using tree centers.

    If you're dumb like me, you can also code a DP(v, maxDepth) that tells you how many vertices you can pick in v's subtree such that the height is smaller or equal to maxDepth and diameter is smaller or equal to K. Recurrence relation is:

    #case 1: biggest child depth is smaller than maxDepth-1
    if maxDepth == 0: dp[v][maxDepth]=1
    else: dp[v][maxDepth] = dp[v][maxDepth-1]
    
    #case 2: biggest child depth is equal to maxDepth-1
    maxAllowedDepth = min(maxDepth-1, k - 1 - maxDepth) 
    s = sum (dp[child][maxAllowedDepth]) 
    dp[v][maxDepth] = max (1 + dp[child][maxDepth-1] + s - dp[child][maxAllowedDepth]);
    
»
10 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Nice problems. How to solve D,E?

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

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

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

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

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

Can the C be done in O(n)?

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

    Yes, instead of checking for every vertex(x in editorial) we only take the center of the tree and remove the nodes which has distance more than K/2(for even). Is It Wrong?

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

      Sure, it is wrong, because the optimal center of the reduced tree does not necessarily coincide with the center of the original tree.

      Imagine a long bamboo and a full binary tree on one of its ends. When you cut just two vertices from the other end, the diameter is decreased by 2, and the center shifts by one vertex.

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

Could anyone please tell why the following fails when k is odd in problem C :
(i)Proceed as when k is even.
(ii)if there is at least one vertex with distance greater than k/2 subtract 1 from the final answer for this centre.

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

Solved E in O(NC). Looks like it wasn't intended.

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

E: We should count the ways to go from (-a_i,-b_i) to (a_j,b_j) and sum them up. It can be done in simple (2000*2)^2 DP and easy modification in the case of i != j.

By the way, it is my first time to get such a good place and I'm very excited!

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

After judging for ~15min about problem F, I got MLE on all the testcases. So can we see the status of each testcase during the judging? And I don't know why the judge is so slow for a MLE code.

And after debuging for ~30min, I found I output the position of each elements in the permutation, and all the three samples are involution(p(p(i)) = i).

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

Thank you snuke, rng_58 (and other who prepared it) for the contest! My thoughts:

  • B: It is interesting. You need to draw a good picture to get the right formula.
  • C: If you know what is the center of a tree, then it will be easy. (so for me it is easier than B)
  • D: A good constructive task. For me the key is to compute the sum of degree: if there are more than 3 odd numbers, then the number of edges can't be enough. A bit complicated but that is fine since you can try many times.
  • E: Very interesting, the solution is quite simple and you just need the right idea. I love this one.
  • F: It is not hard to guess the O(n^2) solution, and you can submit it to know that is correct. I don't have time left to think about how to speed up it.

I think it may be good to give some points for O(n^2) solution for F.

Overall the contest was nice and the difficulty is good (It is too short for me to solve F during the contest, but someone who is good at data struct may have a chance).

Btw, I've experienced some delay (like need 1~2 minutes to load the problem, after hit submit I got 403 error). Maybe it is just because my internet is bad.

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

    Yeah I think subtasks could be an interesting distinguishing feature for @coder compared to cf and tc. Having done IOI with subtasks in high school, it feels very different in a lot of open competitions where there is only AC or nothing. Of course we don't know how much they will use it in future contests but I think it has potential to make for some interesting contests.

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

    Initially we were planning to give partial score for O(n2) in F, but it turned out that the following stupid solution passes:

    while(1){
        updated = false;
        for(i=0;i<N;i++) for(j=0;j<N;j++){
            if(j minus i >= K && P[i] minus P[j] == 1){
                swap(P[i], P[j]);
                updated = true;
            }
        }
        if(!updated) break;
    }
    
»
10 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

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

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

    So you guys take wrong submissions as a factor of rating calculation? I found myself was 81th in the AGC001's standing but 87th in the whole rank. It's a little weird to find myself have a better rank in the standing than someone but gain less rating.

    Anyway thanks for the interesting problems.:)

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

    Well, isn't this update too aggressive? I mean, you calculated the ratings based on only one competition, but the range of rating looks quite wide. Highest is 3154 and lowest is 9. If you incrementally update this rating from now on, I'm afraid that top coders easily get strange ratings such as 6000 and you may set the ratings of many lower coders to 1.

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

      Judging from users' competition history page, I guess the cut-line of so-called target or LGM (I hope there's such a highest grade in AtCoder too!) will be 3900 or 4000. I think just the scale of AtCoder's rating is much larger than TC or CF. Even for the first time my rating is larger than my TC/CF's highest rating.

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

      The rating system is significantly different from TC or CF's rating.

      If you click "Competition History" under the rating graph, you can see the history of performances. For example, from here you can see that his performance was 4020. It represents how well you performed in previous competitions. This value won't explode, and if you take the first place in AGC this value will be always around 4000.

      In TC or CF, if you keep getting the performance of X, your rating starts around the initial rating (1200 or 1500) and gradually converges to X. This means that when X is lower than the initial rating, your rating will gradually decrease. In order to avoid that, in AtCoder's rating system,

      Rating = (weighted average of Performance) — f(# of competitions)

      where f(1) = 866 and f(∞) = 0.

      This means that if you keep getting the performance of X, your rating starts from X - 866 and then gradually converges to X.

      The function f was chosen such that you can't get too high rating just because you get lucky in a few first matches, while the rating converges as fast as possible.

      I omitted some details of rating formula here, it will be published later.

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

Why does the following fail in C when k is odd?

For every vertex, consider it as center. Now find all nodes at distance greater than (k / 2) + 1 (integer division) and add them to a temporary variable.

Now find all nodes that are at a distance exactly equal to k / 2 + 1(say P). We can take at most one node from all such values and therefore add (P - 1) to our temporary variable.

Answer is the minimum of temporary variables value over all vertices.