We will hold JIJ Programming Contest 2026(AtCoder Beginner Contest 476).
- Contest URL: https://atcoder.jp/contests/abc476
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20260919T2100&p1=248
- Duration: 100 minutes
- Writer: sheyasutaka, sounansya, vwxyz0
- Tester: sounansya, vwxyz0
- Rated range: ~ 1999
- The point values: 100-200-300-425-450-525-625
We are looking forward to your participation!








CSP-J1/S1 will be held tomorrow. I wish all Chinese OIers like me good luck and hope we all advance to the next round! All in all, wish everyone rp++ !!! (ps:I'll join this ABC tomorrow.)
Well, it seems that the point gap between F and G is very large. It means that G may be more difficult (this is relative, which means that it will be more difficult than the previous times)
UPD: It turns out that problem G is still easy
Please don't discuss irrelevant content.
it's my first time joining abc=)
RP++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
hope it is not shit
我超威,这题太难了,
Please speak English
何意味
Maybe E is easier than D???
E in my opinion is implementation-only problem, D requires some thought, but a lot easier implementation, so they are probably same difficulty
bro how did u solve d
sort(a), sort(b) let's say we bought some prefix of length i of drinks -> we can do binary search to find max j, such that we can buy prefix of length j of desserts.
Thanks
My first E!
A-E too easy.
F involves 2D prefix sums but implementation is really hard :(
you don't need 2D prefix sums to solve F. the title tells you how to solve (Chebyshev)
fuckkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk !!! if there's 2 minutes more,I will AC D !!!
Easiest E I've ever seen. Tho I couldn't solve D
flipping messed it up... i took way to long to solve such an easy C, and then no time for even D. There is always a next time though
How G?
Editorial mentions an inequality which I didn't know, I have another solution with dp.
$$$hbit(mask)$$$ is highest bit in $$$mask$$$ in 0-indexation ($$$-1$$$ if $$$mask = 0$$$)
We search for the longest non-increasing subsequence in $$$a_L, \ldots, a_R$$$, where $$$a_i = popcnt(i)$$$. Let's go from higher bits to lower. While $$$hbit(L) = hbit(R)$$$ we can just remove the bit. After that let $$$h = hbit(R)$$$. We split the interval into parts $$$[L, 2^h - 1]$$$ and $$$[2^h, R]$$$ and try to merge optimal subsequence from subsequences in these intervals. From the left interval we're only interested in the value of the last element, and from the right interval — only in the first value. Notice also, that the first $$$h$$$ bits in $$$2^h - 1$$$ are on and are off in $$$2^h$$$.
This leads to following dynamics: $$$suf[k][e]$$$ — length of the longest non-increasing subsequence on the interval $$$[L_k, 2^k - 1]$$$ with the last value being at least $$$e$$$. ($$$L_k$$$ means the first $$$k$$$ bits of $$$L$$$), and $$$pref[k][s]$$$ — length on the interval $$$[0, R_k]$$$ with the first value at most $$$s$$$. Answer is $$$\max_{mid} suf[h][mid] + pref[h][mid - 1]$$$. This $$$-1$$$ comes from the bit $$$h$$$ that is on in the second interval.
To find $$$suf[k][e]$$$ we will further split the interval by the highest bit. If $$$k$$$-th bit is on in $$$L$$$, then $$$suf[k][e] = suf[k - 1][e - 1]$$$, otherwise the two intervals are $$$[L, 2^{k-1} - 1]$$$ and $$$[2^{k-1}, 2^k - 1]$$$. If we switch bit $$$k-1$$$ off, then the interval becomes $$$[0, 2^{k-1} - 1]$$$, which is good since it doesn't depend on $$$L$$$ and $$$R$$$ at all, which leads to one more dynamic that will be precalced — $$$dp[k][s][e]$$$ — length on the interval $$$[0, 2^k]$$$ with start at most $$$s$$$ and end at least $$$e$$$.
All of these dps have similar transitions that look as follows:
$$$dp[k][s][e] = \max_{mid} dp[k - 1][s][mid] + dp[k - 1][mid - 1][\max(0, e - 1)]$$$
$$$suf[k][e] = \max_{mid} suf[k - 1][mid] + dp[k - 1][mid - 1][\max(0, e - 1)]$$$
$$$pref[k][s] = \max_{mid} dp[k - 1][s][mid] + pref[k - 1][mid - 1]$$$.
Let $$$K = 60$$$. $$$dp$$$ is calculated in $$$O(K^4)$$$, $$$suf$$$ and $$$pref$$$ are calculated in $$$O(K^3)$$$, so we get $$$O(\log^3 R)$$$ per testcase, that passes because of good constant factor.
I solved E using segment tree.
My sub
I did too, but I implemented it from scratch. How did you just use
segtree<int, mn, e1> s1(n + 1);andsegtree<int, mx, e2> s2(n + 1);?I hope AtCoder can ban all the AI players. The gap between me and 1 Dan is approximately like this.
Yes, I agree with you.
I think only D and G is valuable.Besides,F is a bad problem which requires few thinking but with a lot coding complexity.
When will the Rating Changes happen?
It's my first time to solve all the problems!
D was a nice problem.