We will hold AtCoder Beginner Contest 422.
- Contest URL: https://atcoder.jp/contests/abc422
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20250907T1310&p1=248
- Duration: 100 minutes
- Writer: MMNMM, Nyaan, kyopro_friends, sheyasutaka
- Tester: toam, kyopro_friends
- Rated range: ~ 1999
- The point values: 100-200-300-400-450-500-575
We are looking forward to your participation!








This time is magical.
Surprisingly, it started at 12:10 noon on Sunday.
qp
no, it's 06:10
Respect world cultures, the time zones are different, it is 12:10 under UTC+8.
This new start time is very good.
It's no good for chinese!!!
12:10 on Sunday, couldn't be better
It's good enough, not early in the morning so we don’t have to get up early, it's at noon.
Hope this round won't be as bad as the last one...
AC421 was a good one
pretty early for me, but i will be there!
all the best to everyone :)
Hi, everyone. I surprisingly discovered that yesterday was the 15th day of the seventh lunar month on the lunar calendar. Which is the Zhongyuan Festival in China or maybe the Chūgen Festival in Japan. It's the ghost fesival in China which means the gates of hell are opened up and ghosts are free to roam the earth where they seek food and entertainment. We go on the road and burn paper to guide these goasts So, I think it's the reason why they put off the contest until today. The time 11:10~13:50 (UTC+9) is also the peak of masculine energy according to some mystery.
(It there's anything incorect about the introduction of Chūgen Festival in Japan, welcome to leave your comment.)
I don't think the competieion was postponed because of Zhongyuan Festival, but because of conflict with ARC.
So surprisingly that there is a similar contest on the same time. https://atcoder.jp/contests/jsc2025advance-final
Rlly hope I don't sell this time ;-;
I hope this game will be much better than last time
qp
what does "qp" mean? I see many people commenting that.
“前排”,Not very meaningful:)
qp
qp
Great round. Will the contest still be rated, even with so few participants?
Bro I cannot solve problem D.
I guess we can build answer recursively...
You can build the solution from the last step to first step.
You can start with [k], before that you can have [k/2,k-k/2], before that, you can have [(k/2)/2,(k/2)-(k/2)/2,(k-k/2)/2,(k-k/2)-(k-k/2)/2] and so on...
Is there a solution to this through some linear spacing of the remainders. Or is divide and conquer the only way to go?
Today's problems after C were better than yesterday's ARC imo. Especially; the problem F >>
I guess they have swapped ARC and ABC :))
Has anybody solved using divide and conquer for E?? If successful, please share it.
I solved it picking 2 points randomly and checking the condition. Just some minutes after the end.
randomly pick 2 points for 50-200 times and check will be good.
The solution of C is always surprisingly short.
And, I used binary search like a dumb.
may be there is approach for that but my brain never allow me to do binary search in this problem
Sometimes is useful just implement the binary search (or just another idea) quickly instead of think if there would be a shorter or easier solution and try to prove it, no?
True.
Is there any particular way to solve problem E without using RNG?
help bhai
shuffle points then try points with indices (0, 1), (2, 3), (3, 4)..
Submission
why this giving error , this problems like c are so bad just one line code if someone guess 10 sec to solve if someone not no matter what he do always wrong i first utilise the b then simply take contri of a and c , any case you think about ??
3 0 3 ans should be 2 (AAC + ACC)
thanks sir
Can you please explain me the solution for the problem E as in editorial they are mentioning the randomized approach but i didn't hear that , and one more thing that my approach to make a map of slope and y_intercept and then i will who are having the freq>n+1/2 then thay our answer but for that complexity will go upto n^2 and not allowed can you please help
Let's assume that there exist n/2 points that are on the same line (if not then the answer is NO and it's fine)
Then if you pick 2 random points from our set, there is a $$$(1/2)*(1/2)=1/4$$$ chance that both points that we picked are on that line.
So we just pick 2 random points, and check how many points are on the same line as these two. (That's easy to o in $$$O(n)$$$)
And we repeat this process multiple times to achieve good enough probability of success
For example if we pick 2 random points 100 times, the chance that we won't find such line is $$$(3/4)^{100}$$$ which is almost 0%. So if we didn't find such line after 100 iterations, then we can say the answer is NO
Why problem F couldn't be solved with Dijkstra?
The function which calculates the cost of a path in the graph does not satisfy the dp property.
More info here: https://mirror.codeforces.com/blog/entry/107810
Thanks!
nc blog.
It can be solved with Dijkstra.
https://atcoder.jp/contests/abc422/submissions/69142074
Interesting, what is this technique called? This does not look like pure Dijkstra.
dijkstra with pareto optimality
https://cs.stackexchange.com/questions/148005/set-of-pareto-optimal-paths-in-a-graph-where-edges-have-both-length-and-cost
Can anyone prove my solution for F? I claim that every vertex only have $$$m$$$ pairs of
(current weight, fuel used)being useful , but I can't prove it.my solution
all nice problem!!! althought I just solve 3,but solve the rest problem with Editorial help me learn a lot!!:)
True. Contests with nice problems back to back.
Can you please explain me the solution for the problem E as in editorial they are mentioning the randomized approach but i didn't hear that , and one more thing that my approach to make a map of slope and y_intercept and then i will who are having the freq>n+1/2 then thay our answer but for that complexity will go upto n^2 and not allowed can you please help
Read some probability theory and then read the editorial again.
Is it fair to have random in E? The same solution can be judged differently just by random.
Nope. Using a fixed seed can avoid this problem. Also, the error rate is significantly low, so it almost doesn't matter.
well,it has been prove that the Lower bound of time complexity is $$$O(n^2)\to O(n^{2-O(1))})$$$(3SUM). But since the problem didn't mention how to handle the "no solution" case, just using randomness is okay.
For problem D, first fill vector by $$$\frac{k}{2^n}$$$. Then keep incrementing numbers in even position by 1 alternating between left and right, continue till you have n%{2^k} remaining. If there is still some left then do the same for odd position. The imbalance will always be 1 when there is remainder other than 0.
Why this solution is incorrect??
The checker for question D has a major issue.
When $$$X=0$$$,I output 0 0 0 0......0
When $$$X\neq 0$$$,I output 1 0 0......0
But it is accepted!!!
So checker doesn't consider $$$sum=K$$$!!!
I've noticed this as well.What is the problem writer of D doing???
i also thinked in the same manner but still wrong answer
problem D spj maybe wrong? Without considering K.
https://atcoder.jp/contests/abc422/submissions/69146833
can you please let me know fault in my approach what i am doing is first fill all values with k/2^n then just calculate how much sum is left then just first sort the array and then splitting array like this for
6 6 6 6 7 7 7 7 i make it like 6 7 6 7 6 7 6 7 and then i am calcuating answer for that
There is a discuss of D's checker was wrong :Portal
OAO 发帖人我认识(
For Problem E, there’s a minor issue in the editorial code: https://atcoder.jp/contests/abc422/editorial/13837
Hack:
If the algorithm randomly selects the last two points and computes the line coefficients, it gets a = 5e8, b = 2e9, c = -1.5e18, so |c| > 1e18, which yields a wrong answer. However, the same line has a valid reduced triple (1, 4, -3000000000) after dividing by gcd.