We will hold TOYOTA SYSTEMS Programming Contest 2023(AtCoder Beginner Contest 330).

- Contest URL: https://atcoder.jp/contests/abc330
- Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20231125T2100&p1=248
- Duration: 100 minutes
- Writer: nok0, physics0523, evima, ynymxiaolongbao
- Tester: MMNMM, leaf1415
- Rated range: ~ 1999
- The point values: 100-200-300-400-475-525-625

We are looking forward to your participation!

Good luck for everybody！

Expelliarmus

Good luck for everybody！

Good luck for everybody！

Good luck for everybody！

omg it's the first time i found that there's a discuss of atcoder

Good luck for everybody!

good luck

is there any penalty for wrong submissions in atcoder contests?

Yes. 5 minutes will be added to your time. (But only if you end up solving that question. Wrong submissions on problems, that you don't solve, won't give you any penalties).

Thanks!!

Who the f*%k set today's G? :(

How you solved F? what was the check function in binary search?

Problems D and E are easier than problems B and C.

Can't understand problem statement of B. How to solve?

First,find the minimum value of right hand side then find value of x accordingly.

Codeif A-i < L, print L

if A-i > R, print R

if A-i is in range [L, R], print A-i

Can anyone help with F? I used binary search + two pointers to check, but got 3 WAs in main test, thanks a lot

https://atcoder.jp/contests/abc330/submissions/47936272

I am in the same situation, have you resolved it?

Anyone having problems with E and F can check out my video editorials

If I understand correctly, you're considering the interval can start at some $$$a_i$$$ and finish at $$$a_i + x$$$, but you may be missing the cases where it can finish at some $$$a_i$$$ and start at $$$a_i - x$$$.

To handle this I used a copy of the array with the reversed sign, and then you can take the min between both cases. Code

I have solved this problem, you can try this data： 5 5 3 2 2 1 2 4 0 1 0 2

ty so much

@atcoder_official Code in editorial for problem-F is not formatted.

My code is failing at only testcase for E — Mex and Update. Not able to figure it out.

Please help. link to submission

Is $$$F$$$ solvable through binary search?

Yes.

Can you explain the check function, please? I have been tried to understand others' code, but failed to do it.

Sure my check function handles x and y coordinates separately. I try to find the minimum moves required for all x and y to end in windows of size mid and then if the sum of both coordinates is less than k that's good'

Thank you.

Solution of Problem E

Could anyone tell me the meaning of symbol γ?

Many thanks.

The symbol γ in the editorial of F.

When I run my $$$\mathcal{O}(n \log^2 X)$$$ solution for F on GCC C++, it runs in ~600ms. However, if I run it on clang C++, it runs in ~190ms. Even funnier, if we change a

`max`

function call to if-elses, it TLEs on GCC C++.what the f-

My submission [](https://atcoder.jp/contests/abc330/submissions/47945295) my code even change from WA to AC after switch to clang C++,literally don't know what's going on.

When WA changes to AC if you change the compiler, it might be some rare case of UB. But the TLE case....

ughhhhhhSolution of Problem C

precalculate all squares of num till 4e6 and store them in vec. iterate for all possible x values (<=sqrt(d)) . Then rem=d-x*x. find min possible y less than rem using binary search in vec for y and update ans. Link

Today's B is fun. In fact, Y is unuseful here, we just need let the $$$X_i$$$ smaller (

It was such a pain debugging G because the small samples didn't cover all cases and the big sample was too large to print anything out. Anyways it was a good problem to learn how not to make your code a mess.

How my desperate solution of F passed all test cases?

Wow that's a really smart solution. Considering only the $$$x$$$-cordinate ($$$x,y$$$ are independent), I think the intuition here is that you examine all the possible problematic pairs that create the $$$\max_{i}X_{i}-\min_{i}X_{i}$$$ difference.

Assuming you sort $$$X$$$, at first you look at $$$X_{1}$$$ and $$$X_{N}$$$ (which are the min, max). No matter how you choose the optimal square with side $$$\ell$$$, it will be inside $$$[X_{1},X_{N}]$$$ so you will always just have make $$$X_{1}$$$ bigger to match the left side of the square and $$$X_{N}$$$ smaller to match the right side of the square, in total $$$X_{N}-X_{1}-\ell$$$ times.

After you handle $$$X_{1},X_{N}$$$ change them so they fit the square. Now the min/max pair that will be problematic is $$$X_{2},X_{N-1}$$$, so you continue using the same logic if it is actually problematic, i.e if $$$X_{N-1}-X_{2} >\ell$$$ (notice that if $$$X_{N-1}-X_{2}>\ell$$$ you can also be sure that the square will lie inside $$$[X_{2},X_{N-1}]$$$). Also you don't really have to stop the loop since any pair afterwards will still have a smaller difference than $$$\ell$$$.

Can anyone help with C? I used two pointers , but got WAs in main test, thanks a lot

https://atcoder.jp/contests/abc330/submissions/47945670

How to solve C

Hints are cool, but I think something happened to the code formatting in the English editorial of F :Clueless:

The task_C's constraints is wrong, but I didn't notice about that during the contest. I think it's $$$1 \leq D \leq 2 \times 10^{18}$$$. I hope the wirters will read this comment and fix it.

Sorry, it's right. Never mind.

Can anyone give Test case where it fail's problem E https://atcoder.jp/contests/abc330/submissions/47972996

The problems are very well structured