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

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

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

We are looking forward to your participation!

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

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

atcoder is top 8 contributer now!

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

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

»
2 недели назад, # |
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
»
2 недели назад, # |
  Проголосовать: нравится +25 Проголосовать: не нравится

what the fck was C

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится 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.

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

    I felt like leaving the contest .

»
2 недели назад, # |
  Проголосовать: нравится 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 @_@

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

    small to large merging is simple ??

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

    It's a classic euler tour + monostack problem.

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится 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).

»
2 недели назад, # |
  Проголосовать: нравится 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

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится 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

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

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

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

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

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится 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.

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

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

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

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

»
2 недели назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится
»
2 недели назад, # |
  Проголосовать: нравится 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).

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

    bitmask dp

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится +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.

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

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

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

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

Code
»
2 недели назад, # |
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."

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

D is good.

»
2 недели назад, # |
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

»
2 недели назад, # |
  Проголосовать: нравится +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.

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

    D E easier than C

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится +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.

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится +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.

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится 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.

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

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

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

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

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

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

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

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

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

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

this is the original problem of F?

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

    Why ABC usually has an original problem?

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится 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:(

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

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

    • »
      »
      »
      2 недели назад, # ^ |
        Проголосовать: нравится 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."

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

        Yes,you are right.

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

This problem is same as F!

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

C was exactly same as https://codeforces.net/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

»
2 недели назад, # |
  Проголосовать: нравится +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.

»
2 недели назад, # |
  Проголосовать: нравится -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.

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится +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.

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

      They do nothing wrong. Try not to be too aggressive.

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

        Is it hard to check weight? Inexplicably! Only a fool thinks so. The questions are exactly the same, and luogu is a great site for brushing up on questions, and the bottom line as a question writer is to not come up with exactly the same questions. Even though the questions are in Chinese, can't you learn Chinese? You can't read Chinese, can you? And ziyistudy is stating facts and you're defending a shit group of question writers. I think you are very wrong.

        Translated with www.DeepL.com/Translator (free version)

  • »
    »
    2 недели назад, # ^ |
      Проголосовать: нравится 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.

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

      find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect. find it easy to detect.

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

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

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

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

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

Top 10 contribution!

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

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

»
2 недели назад, # |
  Проголосовать: нравится +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.

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

Can anyone explain Problem G ?