Блог пользователя atcoder_official

Автор atcoder_official, история, 15 месяцев назад, По-английски

We will hold AtCoder Beginner Contest 420.

We are looking forward to your participation!

  • Проголосовать: нравится
  • +26
  • Проголосовать: не нравится

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

it's on Sunday!

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

Waited for a few minutes after 12:00 UTC for the tasks to appear, thinking the site hanged. Turns out its on sunday...

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Some ABCs would be on Sundays later on. Interesting change, ruins my schedule :( but still gonna participate anyways

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

G too easy

»
15 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

Today's E is very easy.

»
15 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

G <<< F !!

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Rubbish round.

»
15 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +10 Проголосовать: не нравится

May I kindly ask who invents the problem G and places it at G?????

Also I missed $$$n \cdot m \le 5 \cdot 10^6$$$ in F and obtain two TLEs because I wrote $$$O(\min^2(n,m)\max(n,m))$$$ with 100 percentage confidence.

  • »
    »
    15 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    How you counted pairs ?? Or you didn't find any need to count them at all. Editorial uses Cartesian Tree but that is still unknown me to me.

    By Pairs I mean this :-

    // 1 <= X <= L. // 1 <= Y <= R. // 2 <= (X + Y) <= Sum.

    Maybe this part is the reason for my TLE. Can you please help ??

    My function looked like this :-

    i64 countPairs(int L, int R, i64 sum) {
    
        // 1 <= X <= L.
        // 1 <= Y <= R.
        // 2 <= (X + Y) <= Sum.
    
        if ((sum == 0) or (sum == 1))
            return 0LL;
    
        i64 a = min(1LL * L, sum - 1);
    
        if (a < 1)
            return 0LL;
    
        i64 b = max(0LL, min(a, sum - R));
        i64 c = b + 1;
    
        i64 ans = b * R;
    
        if (a >= c) {
    
            i64 count = a - c + 1;
            ans += count * sum - (a + c) * count / 2;
        }
    
        return ans;
    }
    
  • »
    »
    15 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +11 Проголосовать: не нравится

    It's funnier because editorial solution for F uses cartesian tree (which isn't necessary) and that's still somehow meant to be easier than G

  • »
    »
    15 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    My solution is similar to yours. But I get an AC after 5 TLEs.

    code

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

where the solution gets uploaded?

»
15 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +16 Проголосовать: не нравится

image

After solving F, my rank only increased by ~100 cuz of G lol

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

bruh round

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Lot of cheating in today round , don't what the point on cheating in the mock exams .

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

A true beginner contest after long time.

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится
»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Swap D and G

»
15 месяцев назад, скрыть # |
← Rev. 3  
Проголосовать: нравится -23 Проголосовать: не нравится

Problem F is so shity. It involves too much discussion between different situations. It's really hard to implement all the details correctly in short time.

PS: It is able to pass using algorithms with complexity O(n*m*min(n,m)), which can be as much as 1e10 operations.

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Well, D was a good exercise in basic BFS implementation, I guess. But the real "challenge" was figuring out why F was seemingly 10x harder than G (which had 10x the passes!). The difficulty allocation this time was truly baffling!

»
15 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

In problem G, 4x-1 = (2m+2n+1)(2m-2n-1). But how people who solved it, come up with this idea? Or there was another approach?

»
15 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +9 Проголосовать: не нравится

Super bad problem G, because G can be solved by chatGPT-5 in 2 minutes and 19 seconds. That's the reason so many people solved G.

Testers in ABC should enforce that at least problem F and G (or at least G) cannot be solved by GPT.

  • »
    »
    15 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    It's nearly impossible. GPT-5 is really powerful yet. It can solve almost all the problems in previous ABCs.

    By the way, why your GPT needs 2 minutes to solve G? I suppose that GPT can solve this problem really fast, somehow in 10 seconds or less.

  • »
    »
    15 месяцев назад, скрыть # ^ |
    ← Rev. 2  
    Проголосовать: нравится +11 Проголосовать: не нравится

    AtCoder rules says "The use of generative AI is generally prohibited during ongoing ABC and ARC." So if someone uses GPT, that’s on them, that's against the rules.

    You said chat gpt needed 2 minutes 19 seconds for G, but that’s just skill issue. With my prompt it solves G in under a minute.

    If you want a non-GPT-able contest then make everything 2500-rated and watch only 100 people solve it. Otherwise stop spamming every contest blog. BEGINNER CONTESTS ARE FOREVER CHATGPT-ABLE. get used to it.

    stop the spam, thank you!

    [this is a reply to everyone complaining, not only to you.]

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

D — Toggle Maze.

Why BFS does work? See input below. Editorial Solution is 14 but correct is 16 : (4,2)->(3,2)->(2,2)->(3,2)->(4,2)->(5,2)->(6,2)->(6,3)->(6,4)->(6,5)->(5,5)->(5,6)->(4,6)->(3,6)->(3,5)->(3,4)->(4,4)

6 6
..o...
.?####
..#...
.S#G#o
??##?.
??x...
»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

excuse me , who solve first problem in 16 freaking seconds

»
15 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +10 Проголосовать: не нравится

As my solution to F was different from editorial:

Assuming $$$N \leq M$$$, (if not, rotate), $$$N*M \leq 5e6 \implies N \leq sqrt(5e6) \lt 2237$$$

So we can bruteforce the upper row $$$r_1$$$ of the rectangle, and the rectangle height $$$h$$$ from $$$1$$$ to $$$\min(K,N-r_1)$$$ (0-indexed). As a result, we also have an upperbound of the maximum width $$$w = \lfloor \frac{K}{h} \rfloor$$$

For the current pair ($$$r_1$$$, $$$h$$$), call a column $$$c$$$ valid if all cells from $$$\text{grid}[r_1\ldots r_1+h-1][c]$$$ are free.

Now, it's a 1D problem. We have $$$M$$$ binary integers (valid column = $$$1$$$). To count all valid rectangles, we can group all contiguous $$$1\text{s}$$$ together. To solve naively in $$$\mathcal{O}(N^2*M)$$$:

For each group of $$$1\text{s}$$$, let the current group have length $$$X$$$

Case 1: $$$X \leq w$$$: Contributes $$$X*(X+1)/2$$$ to the answer

Case 2: $$$X \gt w$$$: Contributes $$$w*(w+1)/2 + (X-w)*w$$$ to the answer

This solution is too slow but we can speed it up.

Precompute for each cell $$$(i,j)$$$, the smallest $$$k$$$ such that $$$i \leq k$$$ and $$$\text{grid}[k][j]$$$ is obstacle (or $$$N$$$ if none exists).

Bruteforce from largest $$$h$$$ to lowest $$$h$$$, and add all columns that are valid for the first time at current $$$h$$$

When adding a column, use a DSU to maintain the current state of the group lengths and use three fenwicks to maintain the answer for each group length. The first fenwick for case 1, the other two to handle case 2. Make sure to start from $$$h = N-r_1$$$ but only add to answer for $$$h \leq k$$$

Final Complexity: $$$\mathcal{O}(N*(N+M)logM)$$$

Submission

  • »
    »
    15 месяцев назад, скрыть # ^ |
     
    Проголосовать: нравится +5 Проголосовать: не нравится

    Thank you for sharing your solution, where the DSU part has really inspired me a lot. My solution is almost the same as yours, but instead of using segment tree, I use dp[x][y] to simplify the calculation.

    Here dp[x][y] means that for a grid consisting of only '.', with x rows and y columns, the number of valid sub-rectangles which start from the first row is dp[x][y]. For instance, dp[3][1] = 3, dp[2][2] = 6. This dp can be calculated based on the idea like two-dimension prefix sum.

»
15 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It was a great contest, I enjoyed it.

»
15 месяцев назад, скрыть # |
← Rev. 2  
Проголосовать: нравится +5 Проголосовать: не нравится

If you solved https://cses.fi/problemset/task/1148 in a fast enough way, you can just paste, change some sizes, sum all rectangles $$$i\cdot j \lt = k$$$ and submit to problem F.