Hello Codeforces!
I am pleased to invite you to participate in 2024 ICPC Asia Taichung Regional Contest (Unrated, Online Mirror, ICPC Rules, Preferably Teams), which will be held on Nov/24/2024 10:05 (Moscow time). This is an online mirror contest for the 2024 ICPC Asia Taichung Regional Contest, and the official offline contest was conducted on November 17th, 2024. The duration of the contest will be 5 hours and the contest is best for teams of three people. The mirror will use the ICPC format.
The contest tasks are proposed by the task authors (baluteshih, waynetuinfor, skylinebaby,samsam2310, hank55663, ltf0501, Jeffrey, Shik, tmt514, Bangye Wu, kasuistry, and Peter Rossmanith), prepared and polished by the judge team (Regional Contest Director Ling-Ju Hung, Chief Judge Peter Rossmanith, kasuistry, Hung-Lung Wang, baluteshih, waynetuinfor, hank55663, cthbst, Sylveon, CindyLinz, marmot0814, tmt514), and tested by the tester team (olmrgcsi, oToToT, jeeeerrrpop, nikilrselvam, Vince729, applepi216). The judges appreciate the testers for their valuable feedback!
We would like to thank MikeMirzayanov for creating the greatest Codeforces platform, and many, many, many helps for making this online mirror contest possible!
This is a photo of the contest venue. Photo Credit: Prof. Jinn-Shyong Yang.
On behalf of the 2024 ICPC Asia Taichung Regional Contest Judge Team, we hope you enjoy this contest and have fun!
Of course, this contest will be unrated.
Updated: the editorial has been released! Please refer to the link in the contest's local website.
Spoiler: It is better than last year
Where can I find last year's problems
https://mirror.codeforces.com/gym/105544
Cheers on the contest! I hope kakaen is not involved.
There was also tnt514
As an official participant, the contest is well-prepared
as an official participant, inserts duck noise
Will Chinese Statements be offered?
There will be English Statements only.
In problem M, what is test case 5 :(((((
I wrote the slow solution and made the submission and got TLE on test 7
Then, I tried generate about 200 test case to check but all of test cases passed. So what is test case 5 :( :( :(
try this input
My solution is 106, is it right ?
The right answer is 90.sort 0 1 0 and 2 1 1 2 2 1 2 1 1
oh thank you so muchhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
How to solve problem H?
Let's instead solve problem with only inequalities of consecutive elements. Let $$$f_x$$$ be the number of possible sequences of
<
and>
of length $$$x$$$. Then number of ways to choose out of $$$n - 1$$$ total comparisons the $$$x$$$ inequalities is $$$\binom{n-1}{x}$$$. Then the total answer is $$$\sum{f_x \cdot \binom{n-1}{x}}$$$Now only inequalities. Let's think, for which sequences of inequalities we can create sequences of elements from $$$1$$$ to $$$k$$$. For example, can we for $$$k = 3$$$ have this sequence:
<<><><<<><>
?No
The has to be no segments of same signs with length greater that $$$k - 1$$$.
So we have simple dp. Assume the first element of sequence is
<
. Then $$$f_x = f_{x - k + 1} + \dots + f_{x - 1}$$$. And the actual number is $$$f_x \cdot 2$$$ (but not for $$$x = 0$$$).But this condition(The has to be no segments of same signs with length greater than k−1 .) is not enough I guess. For example, k=4 and sequence, <<<><<<
Here, no segment is present of the same sign with a length greater than 3. But still, it is not a valid sequence.
Am I missing something?
Got my mistake, this sequence is also valid
It is valid
1 2 3 4 1 2 3 4
If you define ai < ai+1 is -1, ai > ai+1 is 1 and ai = ai+1 is 0
So there was just n — 1 numbers
You can just count number of array just only 1 and -1 with length x (x <= n — 1). After that, if the array have length x, the final step is just add n — 1 — x zeros to some positions in the array.
The problem convert to: How many ways to generate an array with just 1 and -1 with length x ? The fact is number of consecutive 1s and -1s is not more than k. Because if you use p numbers 1, after that is -1, so you just make the different is k again.
And now the problem is easy, just define f[i][0] and f[i][1]: number of arrays with i element and the last is 1 or -1. Just optimize the transition by prefix sum
Is this the solution to L?
Let $$$S$$$ be the square of the polygon. Let $$$O$$$ be the center of mass. Build another polygon, which is the original one, but reflected across point $$$O$$$. Intersect these to polygons. Let the square of intersection be $$$S_I$$$. Then the answer is $$$S - S_I$$$.
Any hint? How to solve cubes?
bitmask dp
What's the intended solution for K? The minimum chain decomposition is small. If we can find that, the rest would be easy. But is it easy to find?
Update. Apparently, greedily choosing the longest chain each time is sufficient to pass. I am still curious about the intended solution.
Don't be confused, greedily choosing the longest chain is one of our intended solutions! You can prove that this approximates the minimum chain decomposition well. Thus, you can find a small enough number of chains and get Accepted.
I don't understand why I'm getting TLE (testcase 23) on my solution, problem M. 293104352
I try every prefix
i
and for eachi
I get the bestj
such that performing the operation prefix_sort(from 0 toi
) and suffix_sort(fromj
ton
) the array is sorted. I useordered_set
to find the position of the strictly smaller element in the prefix[0, i]
(already sorted) of the smaller element in the suffix[j, n]
. This is to find the bestj
when the smallest element of the suffix is smaller than the biggest element of the prefix. I also used an arraycons
wherecons[j] = j+k
such that suffix_sort(fromj
ton
) is the same thing of suffix_sort(fromj+k
ton
) but it is obviously more convenient.I solve the same problem two times because the above solution works only performing prefix sort first. The second time I solve the problem reversing the input array and multipling it by -1, it could be demonstrated that doing like so we found the best solution performing the suffix sort first.
My solution should be O(N*logN) if I don't miss something. I tried to reduce constant factor as much as possible but nothing.
Using a data structure with a large constant factor can be quite risky when n = 1e6.
You can refer to my TLE and AC code for comparison; the only difference between them is that I replaced a set with a priority_queue, which resulted in sufficient optimization to get accepted.
Additionally, I'd like to point out that while my code uses a priority_queue, it can be further optimized to O(n) using a two-pointer approach.
However, you might want to first explore replacing PBDS with other more efficient data structures. Hope this helps!
Thank you for the answer, PBDS are more expansive than I thought! For the problem I used a queue and I got AC :)
Will the official tutorial be published?
Please give us some time, it is still in progress...!
why the answer of this test in problem D is 20
The optimal path here actually is to move down at the start. Since, doing so you can use a pattern such as "RRRDRRRU...", which is more efficient than taking a horizontal line, "RRRLRRRL..."
A 20 move sequence to solve this case would be: "DDRRRDRRRURRRDRRRUUU"
What is the point of modulo in F? Psychological trick??
Yeah think so.
Is the statement of the problem B right? I'm asking because
The accepted solution that I send was to search the N in the gauss formula ( ( N * N + 1 ) / 2 ) so the result of the formula is less or equal to the sum of B + W (you could use binary search or just use brute force), but this should not satisfy the condition established at the statement about not being allowed different pins colors at the same rows "Maw-Shang still wants the colors of the pins on the same row to be identical". The first solution I though was this:
But this gave me a Wrong Answer
I'm a little insecure of comment this, because saying that the statement of a problem could not be correct is a little delicated I guess. Please let me know if I misunderstand the statement or I made an error of any kind.
Yes, in the problem description, it is not allowed to use different pin colors in the same row. However, it can be proven that using the formula like what you said in the accepted solution is still correct.
Your solution program doesn't solve the problem correctly. Any construction given by your solution program will assign the same color in continuous rows, and cannot correctly solve the instance like B=4 W=2.
Ohhh okay, that totally makes sense! Thank you very much
Can you provide the editorial?
Fun fact: problem A has rating of 1300, which is higher than problem B and problem E
Please can anyone help me understand why this DP code is not working for problem B? I want to know is the logic correct? I am getting TLE thats fine but I wanted to know if I am missing something other than the optimization part.
This is not DP, this is just recursion
The logic is (technically) correct, but not the best/expected.
Your current program will have exponential time complexity, not sure how to optimize it.
Is there any editorial?
Hi! Yes, please refer to the link in this page: https://hpc.asia.edu.tw/icpc2024/problem-statement-2/
I am going to add the pdf link to the contest attachments.
Can anyone explain the time complexity in problem C Cubes? I am not able to understand the last simplification there