We will hold AtCoder Beginner Contest 381.
- Contest URL: https://atcoder.jp/contests/abc381
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20241122T2100&p1=248
- Duration: 100 minutes
- Writer: Nyaan, math957963, PCTprobability
- Tester: MtSaka, sounansya
- Rated range: ~ 1999
- The point values: 150-150-300-425-500-525-675
We are looking forward to your participation!








Can we please improve the quality of editorials a bit.. if I am not able to get any clue on how to approach the problem during the contest then I can't just out of the blue understand the editorial with just stating the process rather than helping with some intuition behind the problem.
Problem F editorial was written so badly in abc 380. Other low effort editorials too. Is it just me who feels this?
F's editorial was clear imo. You can interpret "is_first_player_win" as "can_first_player_win" and then simulate the game. The editorial also explains the time complexity and that it does not go in infinite recursion (game always ends). What are you confused about?
G is more hard then past G !
This may be a challenging G for its hiiiiiiiiiigh score!
wait why friday?
Because ARC on Saturday and AGC on Sunday
'coz it's 11/22
Really liked the idea of the contest) Spent too much time on E so didn't solve F(
Weak system tests on D!!
My solution passes system tests but fails for this testcase:
I just need a little bit of hint. Is it possible to do today's E problem E problem using lazy propagation on segment tree?
I tried it and can share code if required, but other than sample none of the test cases is working fine. Should I continue to debug lazy seg tree approach or think in different direction?
E does not need segment tree at all. I just used binary search and prefix sums to solve it in offline mode.
stop learning useless algorithms.learn how to use binary search
Extremely difficult for problem G!
I got 4 Wa on D and 6 Wa on E. :(
for D, why does the following WA?
seenmakes sure that every character appears exactly twice, each consecutive character is equal and I'm only checking for lengths that are even. Maybe I'm misunderstanding the problem statement in some way?note $$$a_i\color{red}{\le} n$$$
I did
--a[i]while reading the input so that should not overflow. The answer is 2 in this case, yeah?ans is
4clearwill not change all elements to0Thanks, I see that this case fails but I'm surprised why
cleardoes not set everything to 0. I also wrote another implementation that works on this case but gets WA regardless.Could you provide your complete code?
For the former code, you can simply use the
setto clear it, although it is $$$O(n\log n)$$$.I don't quite understand the new code you wrote, but you can solve this problem by simply modifying the original code:
You're right, with this change, it worked and got AC. Thank you!
The dataset of E too weak that brute force can accept it.
It's suggested to change the dataset.
Brute-force Code:
It's obvious that a designed dataset like
1/2/1/2/1/2/......can make this solution TLE.i think it's quite not proper to put $$$\color{red}{6}$$$ string problem in an ABC.
by the way, the samples were too weak.
ABC is not the writer's amusement park, but one of the ways that the contestants improve themselves, hope to get better ABC next time.
E is sphrase table and F is dp
it just uses string to show the problem
but still shit
Can you please explain problem F in details ?
$$$\mathrm{dp}_{i,j}:=$$$ the answer of decided what to choose from $$$A_1$$$ to $$$A_i$$$, and:
if I've chosen an even number of numbers, $$$j=0$$$
if odd, $$$j$$$ is the last chosen number
so $$$j$$$ is what I have to choose next time
so dp transition equation is obvious
I am not sure if this is right, if you are trying to form an odd sequence with index i, how do u ensure that dp[i-1][0] (i.e the answer upto index (i-1) with even number of elements) does not contain ar[i], I don't think we can achieve that with the current dp states. Also, can u provide the link to your submission ?
sorry i didn't mentioned the "appears exactly twice". we should use bitmask dp
Hey.. Can you please just hint me what could go wrong if I use segment tree with lazy updates for E.
My logic.
For each query, (l, r), I will find the next '/' ahead of l and prev '/' just behind r using upper and lower bound. Let's call this segment (x, y)
For this segment of array d, I can do a range update. Subtract no. of 1s from 0 to l-1 from the segment (x,y)'s all values of .first (since we stored pairs in segtre). And another range update of subtract no. of 2s from r+1 to n-1 from the segment (x,y)'s all values of .second
Then we can have our query over the segment (x, y) with lazy propagation and then after the query undo the update to be ready for the next query.
I also have the code if you want to see. I have tried debugging for 3 hrs. but can't figure out the issue or why this approach would fail? Is it even possible to apply segment tree to this kind of questions?
maybe
is a hack
also you can do it like this:
if $$$s_{i-1}=s_{i-2}=\cdots=s_{i-l}=1\land s_i=/$$$, then make $$$a_i\leftarrow l$$$, representing there are $$$l$$$ 1-s close to the left of slash $$$s_i$$$. do the same to 2 and $$$b$$$. and $$$c_i:=\min\{a_i,b_i\}$$$. if $$$s_i$$$ isn't slash, then $$$c_i\leftarrow -\infty$$$.
for query, it's just asking $$$\max_{i=l}^r c_i$$$, so it's a sprase table.
note the case of hack
I think your query is min, when you do a range update, you can't preserve it.
For me to solve this problem, I use dichotomy to solve it.
What is dichotomy?
binary search method
i have applied a similar approach, storing prefix of '1' and suffix of '2' but instead of lazy segTree. I apply a ternary search on the array of indexes of slashes. I cant figure out why its giving wrong anwers. as your an array that contains minimum of pfx1[i],sfx2[i] is ternary searchable
in E
WA $$$-$$$ AC = upper_bound $$$-$$$ lower_bound
AtCoder, if you aren't able to set Gs for programming just remove them.
1122?2024/11/22?
The testcases for problem D were so weak.. so I submitted a wrong solution and got AC.
Hope the upcoming contests have a better testing system.
Editorial for E is missing !!! Is it a technical mistake or intended?
let's use O(N^2) brute forces to pass E!
Can anyone look into this, the submission from rank 1 on problem D, is giving wrong answer on stress testing. Link to Code
Test Case:
6
2 5 5 3 2 3
Correct Answer: 2
But rank1 person's code is giving output 6.
Please keep uploading testcases on dropbox link.
C~F are all very good problems.