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?
If you want to find how to approach of a problem, you shouldn't only read the editorial. Doing some other problems with the same type may help you.
Why is there no buzz here?
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
bro thanks a lot for your comment. Now I will be able to participate in the contest . I thought that the contest will held as usual on Saturday!
'coz it's 11/22
Wait, why will it hold on Friday?
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.
Yeah I figured out that count of 1s is a monotonically increasing array and count of 2s is a monotonically decreasing array. But i wasn't able to use this fact properly.
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?
seen
makes 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
4
clear
will not change all elements to0
Thanks, I see that this case fails but I'm surprised why
clear
does 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
set
to 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!
you are right , it helps me!
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
Ohh yeah. binary search looks fine for this question.
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
Is there any thing wrong in this code?
maybe
i - mp[a[i]]
is an odd number.AtCoder, if you aren't able to set Gs for programming just remove them.
1122?2024/11/22?
Oh, I find it interesting!
Can someone please explain problem F in details ?
My solution is use the binary $$$s$$$ to express which $$$a_i$$$ had appear. So you need find the first position the $$$s$$$ appeared.
First, you need preserve for each $$$i$$$ where the next $$$j (1 \leq j \leq 20)$$$ appear.
you solve the $$$s$$$ from $$$1$$$ to $$$2^{20}$$$, you can enumerate the subset $$$g$$$ of $$$s$$$,you know the first position $$$g$$$ appeared and which $$$a_i$$$ you want next, so the $$$s$$$ first position can be found.
Can someone please help me understand why this solution for Question D is WA for 7 cases?
To me, it seemed pretty logical to check two items at once. Can someone please help me with a breaking test case or a scenario I missed?
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?
I didnt accept D.Who can hack my code?
let's use O(N^2) brute forces to pass E!
when will the dropbox update the test data? in fact it only had data up to ABC 377, where are 378 to 381?
Can someone explain problem F to me again? i'm a newbie and the solution is really hard to understand
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.