### chokudai's blog

By chokudai, history, 2 months ago, ,

We will hold AtCoder Beginner Contest 135.

The point values will be 100-200-300-400-500-600.

We are looking forward to your participation!

• +41

 » 2 months ago, # | ← Rev. 2 →   +16 LOVE AtCoder's problems! They are always of good quality! :DUPD: and great difficulty
•  » » 2 months ago, # ^ |   0 Free contribution
•  » » 2 months ago, # ^ |   +13 Another good thing about atcoder is short and to the point problems.
 » 2 months ago, # |   0 How do AtCoder beginner contests compare in difficulty to Div2/Div3?
•  » » 2 months ago, # ^ | ← Rev. 3 →   0 It's easier than Div3 on problems A and B, but sometimes as difficult as Div3 on problems E and F, the overall difficulty is slightly lower than Div3, personally, I believe it's going to be a interesting contest for people with rating below $1450$ on CF.UPD：I was wrong.
•  » » 2 months ago, # ^ | ← Rev. 2 →   +19 The early problems on Atcoder are much easier than any problems on CF.However, in my opinion, the last problem (F) on ABCs is typically substantially harder than the last problem on CF Div3. I think it's harder for me to solve all problems on an ABC (I frequently don't) than all problems on a CF Div3 (I typically do, small sample size though), and since the earlier problems are harder on CF, that implies the later problems are harder on Atcoder.In summary, ABCs are definitely easier than CF Div2, but overall harder than a CF Div3 (if you aim to solve all problems). If you're only aiming to do the first few problems, ABCs are easier than CF Div2 and Div3 both (the first problem on last week's ABC was "input X and output 3X^2").
•  » » » 5 weeks ago, # ^ |   0 How would you compare ABC's E/F problems to that of CF DIV2 ?
•  » » » » 5 weeks ago, # ^ |   0 Much easier, though there's been a good amount of variability. I've solved everything on multiple ABCs, but only done that once on a Div2.
•  » » » » » 5 weeks ago, # ^ |   0 I think ABC E is comparable DIV2C — DIV2Dwhile F is in between Div2D & DIv2E
 » 2 months ago, # | ← Rev. 2 →   0 Where to see the number of people who solved a particular problem during the contest?
•  » » 2 months ago, # ^ |   +9 on the standing page, the last row called Accepted / Tried total # Ac over the overall submissions
 » 2 months ago, # |   +5 How to solve F?
•  » » 2 months ago, # ^ |   +17 Concatenate $S$ with itself until it has a greater length than $S+T$. Then, using a string matching algorithm, check which positions in the first $S$ could be the start of an instance of $T$. For each of these positions, use the length of $T$ to figure out which position, modulo the size of $S$, you'd reach in the concatenated $S$ after placing a copy of $T$ starting here.Afterwards, the problem reduces to longest paths in a directed graph. Our nodes are the positions in $S$ and our edges connect each valid position at which we can place a copy of $T$ to the position at which the next copy of $T$ would start. If this graph contains a cycle, the answer is $-1$. Otherwise, we have longest paths in a DAG, which is a relatively standard problem.
 » 2 months ago, # |   +1 This is absolutely the most difficult ABC problem I've ever seen...Do any one know how to solve D? I tried to use a dp but failed.
•  » » 2 months ago, # ^ |   0 DP states are idx and current remainder. When idx th character of string is equal to '?' then try all digit from 0 to 9.
•  » » 2 months ago, # ^ | ← Rev. 2 →   0 We have to use the divisibility rule of 13 i.e the difference of alternate chunks of 3-digit numbers from the unit place if divisible by 13 than the number is divisible by 13. so we have the form of (A*100 + B*10 + C)%13 = 5. Here A,B,C consist of sum and difference of ? which can take values from 0-9. Sorry this is what I was thinking during the contest but the idea was too tough to implement.
•  » » 2 months ago, # ^ |   +1 SubmissionAccording to the above explanation.
•  » » 2 months ago, # ^ |   +7 Let $dp[i][j]$ be the number of length-$i$ numbers that match the pattern's first $i$ digits and are $j$ mod $13$. Then, we can transition by iterating over every possible digit in the $i+1$'st position, noting that appending a digit $k$ to state $(i, j)$ gives a remainder of $10j+k$ mod $13$.
•  » » 2 months ago, # ^ |   +3 Actually this was a simple digit dp problem. You should explore some problems like that. If you think this problem was difficult, then look into this codechef problem. During contest time I implemented it and got it accepted, I had to use 6-7 parameters to define a dp state. And surprisingly the editorial also used same no. of parameters. Another example of digit dp problem: Atcoder Educational dp contest, problem S
•  » » » 4 weeks ago, # ^ |   0 Can anyone provide link to the editorial
 » 2 months ago, # |   0 How did you solve F(if solved)?
•  » » 2 months ago, # ^ |   +1 I didn't even solve D
•  » » » 2 months ago, # ^ |   0 Use dp ,guy
•  » » » 2 months ago, # ^ |   0
•  » » » 2 months ago, # ^ |   -15 It's so clear
 » 2 months ago, # |   +19 How to solve problem E?
 » 2 months ago, # |   0 I have solve 58 test cases of Problem F out of 73. Than will i get Partial Score or Not. Means at Atcoder there is any concept of partial Score.
•  » » 2 months ago, # ^ |   +7 No
•  » » » 2 months ago, # ^ |   0 Thanks
•  » » 2 months ago, # ^ |   0 No partial scoring
•  » » 2 months ago, # ^ |   0 You will not get partial score
 » 2 months ago, # |   +22 I think problem E and F are put in a wrong order. I can solve F but can't E.
•  » » 2 months ago, # ^ |   0 How did you solve F?
•  » » » 2 months ago, # ^ |   +12 Use KMP and Topsort. I don't sure they are the real English name..
 » 2 months ago, # |   0 How to solve problem D ?
•  » » 2 months ago, # ^ |   +1 DP. States are position and remainder.
•  » » » 2 months ago, # ^ |   0 More details please.
•  » » » » 2 months ago, # ^ |   0
•  » » 2 months ago, # ^ |   +3 Go index wise in the string starting from the left end. Think what will be the contribution of the current number formed till now in the modulo 13. DP[i][j] — stores the number of numbers that can be formed using length up to i and have modulo j with 13.Obviously, i -> (0..n-1) and j (0..12) Since mod 13 only 12 values are possible.Now If at S[i] there is no question mark then the transition is simple. the new number formed is just the previous * 10 + (s[i]), And we have 12 possible previous so check for all of that. Now do % 13 of this and increase the count of the new mod in i. Otherwise, if there is a question mark just do this for all digits from 0 to 9. And update.Finally, the answer is dp[n-1][5]
•  » » » 2 months ago, # ^ |   0 I get it Thank you.
•  » » » 2 months ago, # ^ |   0 iamrk can you show your solution?
•  » » » » 2 months ago, # ^ | ← Rev. 2 →   0 here's my submission, same idea as iamrk
 » 2 months ago, # |   +20 Geothermal please save us
 » 2 months ago, # |   +9 I want anand.oza or Geothermal to put up an English editorial.
•  » » 2 months ago, # ^ |   +20 I won't be posting an editorial today--I was working on one after I finished the contest, but I accidentally hit my backspace key just before I finished, causing me to leave the page and lose all of my work. Unfortunately, I don't have time to write it up again.
•  » » » 2 months ago, # ^ |   0 No editorial any more?!
•  » » » 2 months ago, # ^ |   0 It seems that the editorial is already accessible (albeit in Japanese at the moment)!
•  » » 2 months ago, # ^ |   +8 I didn't participate in the contest this morning, but I'm working on the problems for practice now and might write an editorial (if nobody else has and I actually solve all the problems, haha, but I heard today was a hard round!).
 » 2 months ago, # | ← Rev. 2 →   +3 Any ideas for E. How to solve it?
•  » » 2 months ago, # ^ |   -15 Just recursive dp(dp[i][j])
•  » » » 2 months ago, # ^ |   0 dp[i][j] ?? what dp[i][j] ??
•  » » » » 2 months ago, # ^ |   0 If it is impossible to reach i,j then dp[i][j] will be someting like -1. if not, it will be the minimal number of score needed to reach i,j and the point from witch we went to i,j
•  » » » » » 2 months ago, # ^ |   0 what is i what is j. can you give me your submission link.
•  » » » » » » 2 months ago, # ^ |   -9 i and j are coordinates. I think you do not know dp. I have not submited this problem, I can not wrote the code before ending the contest
•  » » » » » » » 2 months ago, # ^ |   0 i and j are coordinates? i and j can be upto 10^5.
•  » » » » » » » » 2 months ago, # ^ |   0 Use map for this(with key pair )
•  » » » » » » » » » 2 months ago, # ^ |   +6 wrong solution.
•  » » » 2 months ago, # ^ |   +3 This will TLE, as $X$ and $Y$ can be up to $10^5$ and your efficiency is at least $O(XY)$ (or perhaps $O(XYK)$, factoring in transitions).
 » 2 months ago, # |   0 Is this game included in rating?
 » 2 months ago, # |   +1 500 and 600 problems were more difficult this time than general.
•  » » 2 months ago, # ^ |   +1 I think so.
 » 2 months ago, # |   +3 Geothermal How to solve problem E?
•  » » 2 months ago, # ^ |   -35 Just recursive dp(dp[i][j])
•  » » » 2 months ago, # ^ |   0 Anything?
•  » » » » 2 months ago, # ^ |   -29 dp[i][j] is if it is impossible to reach i,j(point with coordinates (i;j) then dp[i][j] will be someting like -1. if not, it will be the minimal number of score needed to reach i,j and the point from witch we went to i,j.
 » 2 months ago, # |   0 Can someone tell me why my F is wrong https://atcoder.jp/contests/abc135/submissions/6580972
•  » » 2 months ago, # ^ |   0 "abb" "bab"
•  » » » 2 months ago, # ^ |   0 thanks le9018468
 » 2 months ago, # | ← Rev. 2 →   0 Will you disqualification a user from the contest if he copy pasted other's code Geothermal? rng_58? chokudai? sigma425? I am asking this because I copyed the code from someone and want to know, will you disqualification me?
•  » » 2 months ago, # ^ |   +10 Dont know about disqualification, but they will tell to improve your english for sure..
•  » » » 2 months ago, # ^ |   0 LOL!
•  » » » 2 months ago, # ^ | ← Rev. 3 →   -19 I hade not disqualification, haha!!!!!!!! my raiting now is 1300+!
 » 2 months ago, # | ← Rev. 2 →   0 What is the topic of problem E? It is computational geometry? I would like to know a lot of about this kind of problem.
•  » » 2 months ago, # ^ |   -26 I solved this with recursive dp: dp[i][j] is if it is impossible to reach i,j(point with coordinates (i;j) then dp[i][j] will be someting like -1. if not, it will be the minimal number of score needed to reach i,j and the point from witch we went to i,j. this may fail in time, so I used rands and probalities and my solution worked with a big chance correct and with a big chance to be fast at test.
•  » » » 2 months ago, # ^ |   +20 Stop saying no sense please!
•  » » » » 2 months ago, # ^ |   -11 If you do not like my post you can just dounvote him. and not writing such sily coments.
•  » » » » » 2 months ago, # ^ |   0 you should be banned
 » 2 months ago, # |   0 How to solve C?
•  » » 2 months ago, # ^ |   0 I store the total number of monsters in a variable say res.Then I check for each i if B[i]>A[i] then we update A[i+1] with A[i+1]-min(A[i+1],(B[i]-A[i])) because ith hero can defeat some of the (i+1)th position monsters. and for each i we have to update final A[i] value.that is max(0,A[i]-B[i]). Finally we calculate the sum of total number of monsters left say res1. So our answer is (res-res1).
•  » » » 5 weeks ago, # ^ | ← Rev. 2 →   0 Hi, I know it's been 3 weeks but I've just tried the question today. About the problem, is it a greedy approach? The ith hero attacks the monsters in the ith city as many as possible, then attack the monsters in (i + 1)th city if possible.If that's what you meant, then my approach is just the same as you. However, my code got WA on submission. Here's the link: https://atcoder.jp/contests/abc135/submissions/6933616. Can you help me figure out what's wrong? I will try to code as what you stated above as well and see the difference.UPD: I figured it out! Integer overflow is gonna trigger me a lot...
 » 2 months ago, # | ← Rev. 2 →   +16 I have one bad solution for F. (Very slow and naive) At first, like everyone, concatenate $S$ with itself until its length greater than $|S|+|T|$. Then, we want to find the greatest number of copy of $T$ which is substring of current $S$. There are many ways to do, but to be more naive, I did binary search and $KMP$ to find it. How to know if the answer is not $-1$? There are a lot of better ways to do, but I concatenate $S$ with itself one more time and did the same thing as previous $S$. If the answer is greater than the previous one, then the answer is $-1$. Otherwise it's our answer. Time complexity: $O((|S|+|T|)log(|S|+|T|))$ (with a very big constant) Not recommend to do this solution. I have to optimize lots of things to make this naive brute force get AC. Submission link:https://atcoder.jp/contests/abc135/submissions/6585502
•  » » 2 months ago, # ^ |   0 I also thought of the same idea but did not implement it as I thought it will TLE :|
•  » » 2 months ago, # ^ |   0 What is the reason for concatenating s with itself until it's length is greater than |S|+|T|?
•  » » » 2 months ago, # ^ |   +1 If $|S|<|T|$, it will never contain $T$ as its substring. When $|S|>|T|$, it has a chance that concatenating it again can make more copies of T as its substring. So we will concatenate it one more time although its length is now greater than $|T|$. Of course, concatenating doesn’t reduce the number of copies of $T$ nor get rid of $T$ in its substring, but cause bigger constant factor. Not related to your question, but I have more optimized submission.(Cutting out log factor) Execution time is not that bad.(65 ms)
•  » » » » 2 months ago, # ^ |   0 Thanks a lot
 » 2 months ago, # |   +35 I changed my mind and decided to rewrite and post my solutions. Feel free to check them out at this link!
•  » » 2 months ago, # ^ |   0 Thanks a lot
 » 2 months ago, # |   0 Why are Atcoder servers so slow at the start of the contest ? The tasks doesn't load for me for the start of 2 — 3 minutes of contest :((. Am I only one facing such situation or anybody else too ?
•  » » 2 months ago, # ^ |   +3 you can use Atcoder's old server  https://abc135.contest.atcoder.jp/  it's kinda fast
•  » » » 2 months ago, # ^ |   0 Thanks, I wasn't aware of such link. :)
 » 2 months ago, # |   0 Can anyone tell me what's the mistake in my solution. it's an iterative one. https://atcoder.jp/contests/abc135/submissions/6591877
 » 2 months ago, # |   0 Can somebody give me the data of problem F? I debug for so long but WA four tests
•  » » 2 months ago, # ^ |   0 I also want the data of problem F. I got WA on seven tests and I don't know what my mistake is.
 » 2 months ago, # | ← Rev. 3 →   0 Only Kotlin 1.0.0 supported? Sheesh, that's tough to work with; all the deprecations and missing features...Though I guess the veterans here would tell me to use a "real" language like ^C(\+\+)?\$ or Rust...edit: fixed the regex
•  » » 2 months ago, # ^ |   0 Btw your regex is backwards
•  » » » 2 months ago, # ^ |   0 lol whups
 » 2 months ago, # |   0 Can someone please explain the D problem with examples or something like that ?
 » 7 weeks ago, # |   0 How to solve E-GOLF problem ?? Is it a dp problem?
•  » » 7 weeks ago, # ^ |   0 Please provide editorial for the contest
 » 3 weeks ago, # |   0 can anyone tell me what's wrong about my solution for problem D pls: https://atcoder.jp/contests/abc135/submissions/7196379