We will hold AtCoder Beginner Contest 430.
- Contest URL: https://atcoder.jp/contests/abc430
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20251101T2100&p1=248
- Duration: 100 minutes
- Writer: kyopro_friends, physics0523
- Tester: sheyasutaka, Nyaan
- Rated range: ~ 1999
- The point values: 100-250-300-400-450-500-625
We have updated the rating system. As these changes will apply starting with this contest, please see this post for details.
We are looking forward to your participation!








We finally get to use the new judge!
just why? new ABC contestants get virtually 1200 instead of 800. the overall rating will rise. I will probably get higher rating without real skill growth.
I can't get 1200 bro:(
Truck Driver ran over my logic, my confidence, and my will to continue.
I feel you brother
I stil try to finde the logic
Try binary search on prefix array.
ok . thanks
The problems are generally good and all, there were no critical issues in the problems, except for just one thing...
I am very curious what they were thinking while preparing problem E...
Maybe they just forget
str.find()in Python uses BM.I mean (well it does use a heuristic to decide between BM and Crochemore and Perrin's Two-way matching), it could have been easily prevented by asking for all $$$k$$$ such that rotating $$$k$$$ times makes $$$A=B$$$...
Or maybe they only considered C++ which afaik has no inbulit string-finding algorithm fast enough for the constraints.
what is BM
Boyer-Moore string matching
It too does not work because of worst case time complexity of n * m.
How is Boyer-Moore n * m?
Python uses heuristics to check for cases when Boyer-Moore must work better, and then resort to Crochemore and Perrin's Two-way Matching algorithm otherwise.
Also towards med — easy , the F
I tried similar in contest but found it died locally to
Turns out I just needed to switch from PyPy to CPython and update the latter from 3.9.
E<<<(a,b,c,d)
What G states: Find the maximum number of elements among $$$S_i$$$...
What I read: Find the maximum elements among $$$S_i$$$...
Therefore, I deserve yet another failure to gain 1 dan.
100
E should be used to teach string matching algorithms and not for a contest.
Personally, C was logically easy but hard to code nice contest though
I haven't read the editorial for C yet since I fried my pea size brain from that problem (will read it tomorrow), but I just want to ask if the solution to that involves prefix sums?
yes i used prefix sum
so my initial idea was correct, but I change it up to use some kind of memoized dfs. st*pid me.
Can we solve F by creating a directed graph for nodes 1 to n and finding the number of topological sortings possible?
My solution https://atcoder.jp/contests/abc430/submissions/70626965 notice that the set of possible positions of number i is an interval [l_i, r_i]. and you can use toposort to count the l_i and r_i l_i is easy, see the code for r_i, you can reverse the edges, and calculate "l_i" in this case, then r_i = n — "l_i" + 1. sorry for pool English (
yes, it is possible using topological sorting, here is my contest submission and i believe it is fairly legible https://atcoder.jp/contests/abc430/submissions/70613464
https://atcoder.jp/users/hyx_xingxing
This guy, gets rk43, I think he used AI.
D: https://atcoder.jp/contests/abc430/submissions/70616970
F: https://atcoder.jp/contests/abc430/submissions/70619227
He only used 8 minutes to write 1904 Byte.
And G: https://atcoder.jp/contests/abc430/submissions/70622170
He only used 12 minutes to write 4478 Byte! How can a normal man do that? And his code seems like AI, too.
Sorry for my weak English : (
And I find lots of new users that use AI to get a high rank, these people ruined our competition experience. A question to those AIers: If you use AI, it means you have already been replaced by AI. And once replaced, how will you live in an even more intelligent future?
Personally, this does not look like AI code to me. Also being a new account and performing well does not mean someone is cheating. Many people practice in their local OIs before doing online contests.
You know people just copy those templates instead of writing it from scratch, right?
Do you also hate it when some big segment tree beats code doesn't work for some reason and the only test which might give you a glimpse of what could be wrong has $$$n, q \ge 20$$$?
Well I don't have any advice for that! Now I even think that STB doesn't work in this problem but can't understand why
G looks really interesting. Any hints please? Is lazy segment tree wrong (I think yes, but idk)? Would some sort of sqrt rebuilding work (again, I think yes, but idk)?
G
Knowing this makes solving $$$G$$$ easier, just have to extend for max and count Submission
After how much time rating is updated now ? When I used to give contests on atcoder 1 year age, then it used to get updated in just 20-30 mins. But till now it didn't.
It usually takes atcoder about an hour to update ratings these days but now I can see my new rating already.
I solved E using a hash algorithm, is there a better algorithm?
You can run the Z algorithm on the string
B + A + A. If you start iterating from $$$i=n$$$ and find the first index such that $$$z[i] \ge n$$$, you've found your answer.https://cp-algorithms.com/string/z-function.html
Link to your solution please?
G can be solved in $$$O(Q \log N + N + \max x)$$$ time with $$$\max x$$$
std::sets and one lazy segment tree.The lazy segment tree maintains the number of elements in each set and supports queries on the max and frequency of max. Separately, for each $$$x$$$, maintain a
std::set$$$is[x]$$$ of disjoint active intervals of sets containing $$$x$$$.On an add update, add the interval $$$[l, r]$$$ to $$$is[x]$$$, with additional updates to keep the intervals in $$$is[x]$$$ disjoint. Propagate all these updates to the segment tree: whenever an interval $$$[l, r]$$$ is added/removed to $$$is[x]$$$ (corresponding to updating $$$S_l, \dots, S_r$$$) add $$$\pm 1$$$ to $$$[l, r]$$$ in the segment tree.
Removal updates are similar. On queries, query the segment tree.
https://atcoder.jp/contests/abc430/submissions/70628647
(KACTL IntervalContainer is really nice here, just modify it to update the segment tree)
Wow, this is a very cool solution. Maintaining the active intervals separately from the actual segment tree is really smart.
PS: The fact that you can bound the number of operations by $$$O(q)$$$ because you can only make $$$2$$$ new segments per operation (one in case of partial intersection, one because of the new addition) is subtle but also nice.
Edit: My implementation of this idea: https://atcoder.jp/contests/abc430/submissions/70633235
i love this contest :)
The difficulty level is moderate; it would be even better if there were number theory problems included.
E was just there for the sake of it
Hello, my account on atcoder simply disappeared. I had an account called Settop. I was doing the ABC today and after the contest, I was browsing the standings page on the website. At some point, my account logged out, and I tried to log in again, but I couldn't: it said the password and username were wrong. So, I used the "Forgot my username" option. When I entered my account email, it sent a message saying there was no account for that email, but I'm sure that was the correct email; I even have a screenshot. Then, using the same email, I created another account and checked the standings to see if I could find anything about the account, but it was simply gone. I hope I can recover my account. Can someone help me please?
I found a O(n logn) solution to problem D, but it gives TLE on test 8. I don't know why can someone explain?
https://atcoder.jp/contests/abc430/submissions/70631585
The Problem lies in this two lines in ur code:
Because the insertion complexity in a vector is generally O(N) which makes ur solution O(n^2 logn).
ok i solved same problem with iterators and it passed. tysm!
it can also be solved with a combo of 2 pointers with sliding window and binary search. 1) find a window with exactly A a and less then B b. 2) find the most right possible R with a binary search over a prefix sum array 3) increment L
I tried to solve C using dp, where dp[i] = dp[i-1] + la — lb + 1, if (la > lb). There are other cases too, but this is the core recurrence. Did anyone try a similar or any DP approach for C? Did you AC?
Forgot to mention la is the largest index less than i such that [la,i] contains A number of 'a's and b is the largest index < i such that [lb,i] contains B number of 'b's, ie [lb+1,i] contains less than B 'b's.
when you solve a problem using dp[i] = dp[i-1] + (blah blah), and you print dp[n] in the end, your answer is basically the sum of (blah blah) for every index. if you create a int res = 0, and then (res += la — lb + 1) for every index, you get the same solution. so your solution is just like the usual O(n logn) solution (i solved it the same way btw)
really nice solution but this is just not called DP
That's not DP though.
I can't seem to figure out why this should fail for problem E. Any help will be greatly appreciated.
Does anyone know why the following solution for D gets TLE? Mycode
I think it's essentially the same solution as Solution 2 in the editorial. Any recommendations will be greatly appreciated.
Never mind. I figured it out. We should use set.lower_bound(a) instead of lower_bound(set.begin(), set.end(), a).
Why is kenkoooo not working again on my computer?(Please do not downvote my comment if you don't like)
Can E be done using string hash? If so, what is the hash function?
I have tried the function of $$$h(A)=(\sum_{i=0}^{|A|}a_i\cdot 2^i)\mod 998244343$$$, where $$$A$$$ is the string. However, it got 21 WAs in AtCoder. Here is the submission link. Sorry for my poor English.