meisgood's blog

By meisgood, history, 3 months ago, In English

I have just come up with 2 new problems inspired by today's div2D 2194D - Table Cut and I think they are quite interesting so I hope to share them with you all.

Original Problem :

(refer to the original statement for more clarity)
" Given a table of size $$$n \cdot m$$$, where each cell contains either $$$0$$$ or $$$1$$$. The task is to divide it into two parts with a cut that goes from the top left corner to the bottom right corner. The cut lines can only go right or down.

$$$a$$$ = the number of ones in the left part of the table after the cut,
$$$b$$$ = the number of ones in the other part of the table.
Maximize the value of $$$a \cdot b$$$. "

New Problem 1:

$$$a$$$ = the number of ones s in the left part of the table after the cut,
$$$b$$$ = the number of zeros in the other part of the table.
Maximize the value of $$$a$$$ plus $$$b$$$.

Solution

New Problem 2 (Not yet solved):

$$$a$$$ = the number of ones in the left part of the table after the cut,
$$$b$$$ = the number of zeros in the other part of the table.
Maximize the value of $$$a \cdot b$$$.

Not Yet Solved

Feel free to discuss the solutions of these problems in the comment section!

Full text and comments »

  • Vote: I like it
  • +37
  • Vote: I do not like it

By meisgood, history, 7 months ago, In English

Why the quality of tasks in recent contest is getting worse?

Before, codeforces tasks often requires data structures and algorithms like graphs, binary search, and techniques like dp and d&c, but in recent contests (not all, but most), most of the tasks don't require them. Those tasks only requires observations to solve. For example in Codeforces Global Round 29 (Div. 1 + Div. 2) qA-D, I can't see any dp, any graphs, any data structures, but only stupid observations and greedy is needed. I dislike this style very much.

First of all, usually the observations are not easy to prove, therefore most contestants are solving them by pure guessing. This is basically “if u can guess it correctly, you can solve the task or else you will waste 3 hours to debug a wrong solution”. This is requiring more luck than real skills to get good results.

Second, this is making hard work useless. Before, people can improve their codeforces performances by learning more algorithms or techniques and practising. Now, practising is a lot less important as the only skill required for getting good results is observing and guessing patterns.

Actually, not only codeforces contest have this issue, but even in IOI style contests (for example APIO2025 which have two interactive and one greedy with strange observetion, and IOI2025 day 1 which have 3 non-batch tasks), data structures and algorithms is becoming more and more rare.

I am not writing this because I'm angry for my large rating drop, but I really think this style is making lots of negative impact on competetive programming.

I sincerely hope OI contests can be great like before.

Upd : many of the comments are saying codeforces contests are good for their observation based style. I DO NOT think it is wrong, but i think it would be bad if the task requires ONLY observations but not data structures and algorithms. A task is also bad when it only requires dsa knowledge . A true good task should require BOTH of these skills and they are BALANCED.

Full text and comments »

  • Vote: I like it
  • -45
  • Vote: I do not like it

By meisgood, 20 months ago, In English

Recently in the div 4 contest (Codeforces Round 964 (Div. 4)), I tried to hack some people's problem E solution, and I find some strange things.

In problem E, the solution should be like this :
1. for all x from 1 to 2e5, precompute the number of operations needed for x to become 0
2. construct a partial sum array to store those information
3. for each query, use O(1) time complexity to answer with partial sum
(you can refer to the editorial for more)

I AC the task with time 109ms with the solution described above.

However, after the contest, I found that there are many people passed this task without using partial sum, instead they just use O(n) time complexity for each query. The time used by these solutions are about 800ms-900ms, which didn't cause TLE.

But why? If we use a test case that all query is 1 200000, the code will loop more than 1e4*2e5=2e9 times, which is not expected to pass, even with the pragma gcc optimize thing.

I have attempted to hack many of those solutions, but only one of it is successful hack.
submission
hack case
The above one is one of the submission that I got an unsuccessful hack. This solution passed the case in 827ms.
submission
The above one is one of the submission that I got an successful hack. (TLE)

Is that the compiler "helped" the author to make a fast range sum query automatically? If not why this happened?

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it