We will hold AtCoder Beginner Contest 403.
- Contest URL: https://atcoder.jp/contests/abc403
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20250427T2100&p1=248
- Duration: 100 minutes
- Writer: sotanishy, toam
- Tester: math957963, cn449
- Rated range: ~ 1999
- The point values: 100-250-300-425-500-500-600
We are looking forward to your participation!








one step closer to Round 404
Why unusual day?
Probably because of AHC046 need to be held on Saturday.
May be it's a special code "404 Page Not Found"
why on Sunday?
My first time to take part in Sunday ABC.
No... I didn't solve G because I didn't use
pushup...Why is the contest on Sunday? The one day I get off and want to play with my friends and you keep a contest in the evening :(
I have a May Day holiday adjustment, and have to go to school on Sunday, why not on Saturday?? :(
Huh?tomorrow?just rushed home to participate
Hello, AtCoder! I think Codeforces competitions are no longer suitable for me. Therefore, I registered an AtCoder account named zhoujiarun, and I'm going to start challenging the ABC contests! I'll begin by aiming for my first AK (all problems solved) in an ABC contest.
Why? Nonono, plz solve 6 problems in Educational Codeforces Round 178 (Rated for Div. 2) and 7 problems in Codeforces Round 1023 (Div. 1) to let us witness the strength of LLM
u only solve two problems lol
Why did you only solve A and B?
Joker.
waiting for your last joker, or probably you are a joker.
Will the submission during the competition also undergo tedious human-machine verification?
The worst ABC
We have worse ABC than this obviously.
At least not an entire speed round.
G could also be solved in $$$O(q \sqrt{q})$$$
Submission
Ohh nice, I tested my treap in G with (N+Q)LogN LOL XD
Why does this DSU + DP solution on D not work ?
What I am doing is creating chains of AP
1->3->5->7->9->11..
2->4->6..
etc
Then we want to remove elements from these chains such that adjacent elements in chain have to be deleted. We use dp to find minimum elements to remove per chain.
It gives WA on 5 TCs
Me too,have you found any wrong for this?
My solution is similar to yours,but I didn't use dsu.I just noted a[i] and a[i]+m(if they exist) to a vector which was grouped by the element in it mod d.Then my solution was same as yours.
Just a suggestion regarding the type of problems in ABCs. Of course, ABCs are meant to be educational, but that doesn't mean they need to have problems with no observations. What about including standard problems that also involve standard observations (maybe some common invariant, mathematical property, etc.)? I think most people are weaker at observation-based problems and would love to get better at them. Such problems are also more fun to solve, unlike problems like E today. I would love to see one or two standard/educational observation-based or constructive problems per contest in future ABCs, if possible.
For D, can someone help point out a case where this is wrong?
So basically I formed an array of frequencies of numbers that are in a chain (for example, if $$$D=3$$$ and the array is $$$\text{1 1 1 4 7 13 13 16 7 7}$$$, I have two arrays: $$$\text{3 1 3}$$$ (for $$$\text{1 4 7}$$$) and $$$\text{2 1}$$$ (for $$$\text{13 16}$$$). Then, for each array $$$l$$$, I used this dp formula: $$$dp[i]=\text{min}(l[i]+dp[i+1],\ l[i+1]+dp[i+2])$$$. At each step $$$i$$$ either I keep $$$l[i]$$$ and thus have to delete $$$l[i+1]$$$, then proceed with $$$l[i+2:]$$$, or I delete $$$l[i]$$$ and proceed with $$$l[i+1:]$$$. I handled $$$D=0$$$ separately and still got 6 WAs.
after you form those, there is a greedy which works. for each $$$ i, 2 \lt = i \lt = |chain| $$$ add $$$chain_{i - 1}$$$ and $$$ chain_i $$$ $$$ min(freq_{chain_{i - 1}}, freq_{chain_i}) $$$ times in the resultant array. Let $$$ p $$$ be a collection of only uniques in that chain. Let $$$ newFreq_j $$$ be the total frequency of $$$ j $$$ in the chain. Then answer is sum of $$$ newFreq_{chain_i} $$$ for all even indices (1-based)
I was trying to solve D without DP. what is the issue with below code
https://atcoder.jp/contests/abc403/submissions/65293401
Your code fails on the following case (the answer is 2 but your code gives 3):
it seems that only taking the odd or even is not always optimal
I don't know the specific logic of his code but a greedy works by only picking elements at even indices. My submission
can you please explain your approach in details?
Idk if I'll be able to explain properly but I'll try my best. I'll reply in some time.
ok waiting
while explaining I'll be using $$$d = 1$$$, $$$a = [1, 3, 4, 4, 5, 5, 5, 8, 9, 13, 20]$$$. Also denote the frequency of $$$ith$$$ element as $$$f_i$$$.
Observation 1:
Observation 2:
We need exactly $$$ min(f_{a_i}, f_{a_j}) $$$ elements to be removed.
READ THE SPOILER!
Let $$$ x = min(f_{a_i}, f_{a_j}) $$$ then our frequency gets updated to $$$f_{a_i} - x$$$ and $$$f_{a_j} - x$$$. We keep going and going. Now, I'm going to simulate this process for the array we took as an example:
(Sort the array)
I'll call the resultant array with only required elements as $$$ c $$$ and the frequency of the $$$ i$$$ in $$$ c $$$ to be $$$ o_i $$$. JUST A QUICK NOTE: Make sure that $$$a$$$ only has unique elements when processing, and our $$$c$$$ will also only have unique elements.
$$$ a $$$ with unique elements = $$$ [1, 3, 4, 5, 8, 9, 13, 20] $$$.
at $$$ i = 0 $$$ the required element $$$ 1 - 1 = 0 $$$ doesn't exist so we continue.
the same is true for $$$ i = 1 $$$ so we continue again.
at $$$ i = 2 $$$, our required element $$$ 4 - 1 = 3 $$$ exists. Time to compute our $$$x$$$ which would be $$$min(f_3, f_4)$$$ and it turns out be 1. Update the frequencies of $$$3$$$ and $$$4$$$ in $$$c$$$ to $$$1$$$ and add them in $$$c$$$. also decrease the frequencies $$$f_i$$$ for them. $$$f_4$$$ becomes 1 (decreasing $$$f_3$$$ isn't really required).
now at $$$ i = 3 $$$ we have $$$x = min(f_4, f_5) = \gt 1$$$. its because $$$f_4$$$ decreased to 1 in previous step. so update the frequencies in $$$c$$$ again.
Continue this process for each element, you will get $$$c = [3, 4, 5, 8, 9]$$$ with frequencies as follows:
$$$o_3 = 1$$$
$$$o_4 = 2$$$
$$$o_5 = 1$$$
$$$o_8 = 1$$$
$$$o_9 = 1$$$
Observation 3:
So after making the array $$$ c $$$, just separate it into blocks of the form $$$ [x, x + d, x + 2d, ...] $$$ and iterate over odd positions (0-based) and add their frequencies to answer.
I tried my best. If there's any confusion, feel free to ask.
Are the CP gods with me for this submission?
https://atcoder.jp/contests/abc403/submissions/65298809
lol exact 2000 ms
I use hash to solve the problem E, but the data stuck my modulus. I even use the double hash to get AC.
So many cheaters. Examples:
As you are aware, when cheating occurs in rated contests, it unfairly alters the standings and consequently impacts the rating changes of honest participants. Honest players may suffer unjust rating losses or smaller gains because cheaters artificially occupy higher positions on the leaderboard. This undermines both the fairness of the competition and the credibility of the rating system.
atcoder_official, I kindly ask you to investigate these submissions. If any violations are confirmed, I would respectfully request that appropriate actions be taken, such as disqualifying the offender and adjusting the ratings of affected participants, if possible.
why problem D can't apply binary search and greedy to solve? To every distinct element in the A,then find a sequence that has a diiference of D ,and choose the less number between the number of odd index and even index. Got WA in 15 testcases(.