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

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

We will hold UNIQUE VISION Programming Contest 2024 Summer (AtCoder Beginner Contest 359).

We are looking forward to your participation!

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

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

atcoder is top 8 contributer now!

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

After many many exams in the school, many many students begin their AtCoder tours again :)

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

Idk how I passed C after 4 WAs, just did some +/- math. Idea was to move diagonally as much as possible and align the x coordinate or y coordinate with the target node.

Code
»
8 дней назад, # |
  Проголосовать: нравится +25 Проголосовать: не нравится

what the fck was C

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

    Idk man, I just figured some +/- math after moving diagonally as much as possible and aligning resultant x or y with target node. After that it was tricky to move in the same direction where I did some guessing.

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

    I felt like leaving the contest .

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

Is there a simpler solution to G than Small to Large merging? Or did people just manage to implement that approach in like 5 mins @_@

  • »
    »
    8 дней назад, # ^ |
      Проголосовать: нравится -8 Проголосовать: не нравится

    small to large merging is simple ??

  • »
    »
    8 дней назад, # ^ |
      Проголосовать: нравится +18 Проголосовать: не нравится

    It's a classic euler tour + monostack problem.

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

    There are indeed simpler solutions, but small to large merging is also simple enough. It's only about 30 lines and 5 mins or so is enough to implement it (my solution in contest was small to large merging).

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

      Could you roughly explain your approach using small-to-large merging?

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

can someone please explain the idea behind the 3rd question import math a,b=map(int,input().split()) c,d=map(int,input().split()) t=math.ceil(1.5*abs(b-d))

if t<=abs(a-c) and t!=0: print(int(abs(a-c) -1.5*abs(b-d))//2 + abs(b-d)+1) else: a=abs(b-d) print(a) please explain me why my code is incorrect please

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

    you can try to move the initial and the end points to adjacent ones (where (x + y) mod 2 = 0) such that each one is still in its tile and then draft some examples

»
8 дней назад, # |
Rev. 3   Проголосовать: нравится +3 Проголосовать: не нравится

My solution for problem-D is to store last K characters as state. AC

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

Great contest. D was a really good problem, wish I would've solved E a bit quicker though. Also, How to do C?

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

    Idea is to move diagonally as much as possible and then align target with the resultant x or y coordinate. Tricky part was to move in the same direction in x. In y its just that difference of y coordinates as height of tiles are 1.

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

how can we get atcoder contest testcase at which our solution got failed...

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

Anybody who found C,D tougher than E,F or just me?

»
8 дней назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится
»
8 дней назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Anyone can give hints on how to solve D?.

My approach to count all the possibilities such there is atleast 1 subarray of K length that is a palindrome and then the subtract that from 2^q and get the answer, but I couldn't calculate it properly(due to overcounting).

  • »
    »
    8 дней назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    bitmask dp

  • »
    »
    8 дней назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    Let $$$dp[i][m]$$$ (for $$$k - 1 \leq i \lt n$$$) represent the number of ways of constructing a good prefix of the first $$$i$$$ characters ending with mask $$$m$$$.

    For $$$i = k - 1$$$, this is fairly direct, check all $$$2^k$$$ possible masks and see if they work (are possible and don't contain any palindromes). If they do, set $$$dp[k - 1][m] = 1$$$, otherwise set it to $$$0$$$.

    Now notice that the masks for position $$$i$$$ and $$$i - 1$$$ share $$$k - 1$$$ characters. So for any $$$i \geq k$$$, we can check each of the $$$2^k$$$ masks again. If a mask $$$m$$$ is valid, we simply calculate $$$dp[i][m] = dp[i - 1][m'] + dp[i - 1][m' + 1]$$$ where $$$m'$$$ is $$$m$$$ with its highest ($$$(k - 1)$$$-th) bit disabled.

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

I think problem B's statement could have been made a lot easier to understand.

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

My code failed for last three testcases in C.Can someone point out where the mistake lies?

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

"Can anyone explain C, please? I should have at least tried d, as I've spent so much time with C, actually, not so much time but significant time. I'm feeling bad about it now."

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

D is good.

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

I used small to large in G. But I can't understand what's wrong in my solution. mp[v][c] contains two numbers: the number of vertices of color c in v's subtree and the total length of paths to them.

Code

UPD: submission

UPD2: I found issue, AC

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

If C has a million haters I'm one of them. If C has a hundred haters I'm one of them. If C has one hater it's me. If C has zero haters I have died. If the world is against C I am with the world, if the world is for C I am against the world.

  • »
    »
    8 дней назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    D E easier than C

  • »
    »
    8 дней назад, # ^ |
      Проголосовать: нравится +25 Проголосовать: не нравится

    Tbh C was cute problem. I didn't like it either, but it's really simple and solution is pretty concise. I feel like CP turned into mindlessly rewriting same algos over and over, especially on AtCoder ABC. Problems like this humiliate you in a good way.

  • »
    »
    8 дней назад, # ^ |
      Проголосовать: нравится +33 Проголосовать: не нравится

    I also don't like problems like this one. But since ABC is supposed to be educational, I try to make use of such problems. For example, I've learned the following lessons (in this particular order):

    1. Skip nasty non-standard grid problems whenever it's possible. Especially if there are problems with more points to get.

    2. Try to find out "simple observation" (as they will call it in editorial for sure) before considering shit tons of edge cases.

    3. Test your solution like crazy. After the first WA, write stress test immediately, don't wait for luck.

    4. Solving more and more similar problems make your more resistant and prepared to them.

    5. Competitive programming is 100% pain.

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

    If C has n haters ($$$ 3 \le n $$$) I'm one of them. If C has two haters that's you and me. If C has one hater I have AFOed. If the world is for C, I'm with you.

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

E was stack and $$$\text{O(N)}$$$ ? (Asking cuz constraints had 2e5)

Code
»
8 дней назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

So typical problem G. Maybe it will be better to swap some orders of the problem.

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

Could you guys just STOP making "greedy in grid" problems such as C plz? :(

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

how can we get atcoder contest testcase at which our solution got failed...

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

https://www.luogu.com.cn/problem/P7840

this is the original problem of F?

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

    Why ABC usually has an original problem?

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

    My code which get AC in AT also get AC in LG!

    But I suppose it wasn't on purpose, as there weren't many easy ideas:(

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

    But I think ABC is a good way to let us find the same problem so that get AC.

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

      so that get AC is wrong in grammar,you should modify it to be "so that you can get AC on the original problem."

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

This problem is same as F!

»
8 дней назад, # |
Rev. 3   Проголосовать: нравится +21 Проголосовать: не нравится

C was exactly same as https://codeforces.com/contest/1421/problem/D. Just consider the right point of tiles (moving between left and right didn't encounter any cost), and those right points forms the hexagon.

It can be solved via linear algebra, no need to go into greedy

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

Problem F has appeared here previously : https://www.luogu.com.cn/problem/P7840

However, Luogu is a website that currently mainly used in China. So I think it is a coincidence. I only point out for notice.

Here is the translation by Copilot:

  • There are $$$n$$$ servers.
  • Each server has a busyness level denoted by $$$v_i$$$.
  • The servers are connected using $$$n−1$$$ network links.
  • Each server has a connection count $$$d_i$$$.

The total running time of the server network is given by the expression:

$$$ \sum_{i = 1}^n d_i^2 v_i $$$

The goal is to minimize this value.

»
8 дней назад, # |
  Проголосовать: нравится -29 Проголосовать: не нравится

Didn't Atcoder check for if there have been the same problem???

This problem from Luogu same as today's G.

And this problem is from the year 2021.

  • »
    »
    8 дней назад, # ^ |
      Проголосовать: нравится +26 Проголосовать: не нравится

    It is a Chinese website and it only support Chinese... It is extremely difficult to check EVERY CP website and search whether there is a same problem. So It can be only coincidence. BTW it didn't cause any significant effect, because it is just an ABC contest.

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

    I don't think the testers can find this problem. It's from China.

    However, the impact is not significant, as even Chinese people find it difficult to detect.

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

Why inclusive-exclusive algorithm doesn't work in problem D?

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

    I'm stupid... How dare me apply inclusive-exclusive algorithm for n-k elements!!!! I thought n-k<=10....

»
8 дней назад, # |
  Проголосовать: нравится -13 Проголосовать: не нравится

Top 10 contribution!

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

I wonder how to prove that greedy algorithm is correct for problem F. Would anyone like to share your ideas? Thanks a lot.

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

I see some solutions using Small to Large technique, so I'd like to share 5 problems (in increasing order of difficulty) for someone who is not familiar with this topic and want to learn it.

Plain Small to Large

  1. Distinct Colors
  2. Confuzzle
  3. It is a Tree : Subtask 2

Small to Large + Advanced DP

  1. Count Paths
  2. Leaf Color

For problems from BOJ, either use Google Translate or add the problem to Vjudge and use the inbuilt translator option.

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

Can anyone explain Problem G ?