ABC465 Participation Report
It’s me.
I participated in ABC465. I reached Green rank by solving 4 problems relatively quickly. I’ll write a separate post about reaching Green later.
By the way, this was my first time getting a Cyan-level performance rating. I hope to be able to achieve this consistently.
Problem A Supermajority
It’s the same as ABC463 - A.
There is no need to use floating-point numbers. You can just triple both sides of and check if A * 3 > B * 2 is true.
Problem B Parking 2
As a wise person once said: “It’s better to solve a problem reliably in than to try to be too clever with .”
For each time , consider the fee from time to .
- If , add
- Otherwise, add
Since the time is 23 or less in this problem, simulating the fee addition hour by hour is sufficient.
Problem C Reverse Permutation
Problems like this, which aren’t strictly about algorithms or data structures, are the most interesting. That’s right—let’s use “Sample ESP” (guessing the logic from samples).
Immediately before the operation for , is at the end of the range being operated on. Therefore, after the operation, moves to the following position:
- If is
o, it moves to the front. - If is
x, it remains at the end.
Thus, we can read the operations in the order and fill in the answer from the outside. By keeping track of the left and right ends of the unconfirmed part and whether the orientation is reversed, we can decide which end to place at.
- If not reversed: place at the left end if
o, and at the right end ifx. - If reversed: swap the side where you place it.
- If it’s
o, flip the orientation after placing it.
By preparing an array of length in advance and managing the left and right write positions, you can implement this in without using a Deque.
Problem D X to Y
Setting aside whether they are truly similar, I’ll list Codeforces 1103 (Div.3) - C: Omsk Programmers as a related problem.
The operations in this problem can be divided into the following two types:
- Operation 1: Update to
- Operation 2: Update to any integer in the interval
The destination for Operation 1 is uniquely determined, but Operation 2 has multiple possible destinations. Therefore, it is difficult to think from the side about which value to choose in Operation 2.
Here, instead of performing Operation 2 on , consider performing Operation 1 on . From ‘s perspective, there are multiple destinations for Operation 2, but if you trace back from the destination , it is uniquely determined as .
Therefore, as long as , you just need to divide the larger of and by .
For example, with , is larger, so:
This makes in a single step. You just need to keep dividing the larger value by until and count the number of operations.
Initially, I tried to represent the floor function using floating-point numbers and got a WA (Wrong Answer). However, since and can be up to , they cannot be held accurately as floating-point numbers. Using integer division will truncate the value correctly.
Problem E Digit Circus
I couldn’t solve it.
It reminded me of the “Sekai no Nabeatsu” gag, but I’m not very familiar with problems involving huge numbers.
Looking at Twitter after the contest, it seems people used something called Digit DP. I think I’ll take this opportunity to study it.
Final Thoughts
I’ve finally reached Green rank.
I’ll keep working hard and not get complacent.
This was Twil3akine.
Oh, and everyone, don’t forget to do Heuristic contests too!