ABC482 Participation Report

It’s me.

I haven’t been practicing, but I participated anyway. I won big. I’m so confused~~~~🫨🫨🫨🫨🫨

────────────Do your practice properly!😡


Problem A Nigiri

At first, I tried to count using filter and count, but it didn’t work out. In the end, I checked character by character from the front, counting while verifying if it matched o.

If I actually wanted to complete it using methods, it seems like it would look something like this:

let cnt = s.iter().filter(|&&c| c == 'o').count();

Problem B Blank Bingo

Seriously, just do what it says.


Problem C Band Count

When I first saw it, it looked super tedious, but it turned out all I needed to do was store rows and columns separately, sort them, and perform binary search. For some reason, I had a mental breakdown thinking it would be better to use coordinate compression.

Generalizing u, d, l, r, and letting x,y  (x<y)x, y \; (x < y), the answer is:

C1→y−C1→(x−1)C_{1 \rightarrow y} - C_{1 \rightarrow (x - 1)}

I wasted time on a library I had never used before, which was a real shame…

Don’t do things you aren’t used to. Stay calm.


Problem D Wannabe Zombie

I’m super happy I was able to solve this kind of ad-hoc problem. I remember being really disappointed about this one ( ABC414D ).

To put it briefly,

If an edge gets infected, the answer is X[N−1]−X[0]2\frac{X[N-1] - X[0]}{2}.

Otherwise, the answer is whichever of the following takes less time:

  • The infected person infects the one directly to their left, then moves right
  • The infected person infects the one directly to their right, then moves left

Problem E Diameter Endpoint Colors

Lately I’ve only been setting up my library, but I haven’t set up tree-related libraries at all. It was also my first time finding a tree diameter, so I couldn’t finish solving it, as expected~.

My approach was to first find the diameter dd, and then use the HLD go method (or something like that) that came up on Qiita to traverse to the vertex dd steps away from each vertex, looking for all pairs with the same color.

Honestly, I don’t really get it. But I did learn that HLD is useful.


In Conclusion

There’s no way I could solve F and G!! Give me a break!🤬🤬🤬🤬

Overall, it’s hilarious that my rating goes up when I don’t practice.

Well then, see you next time.