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

Автор chokudai, история, 5 лет назад, По-английски

We will hold Sciseed Programming Contest 2021(AtCoder Beginner Contest 219).

The point values will be 100-200-300-400-500-500-600-600.

We are looking forward to your participation!

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

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

One of the best educational contests. Thanks atcoder!

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

What a action packed day tommorow :0

ABC -> CF -> kickstart back to back with around 30 min break in between each of them.

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

so the recent AtCoder rounds have two extra problems than the regular ones we used to, these two problems have 500, 600 difficulty, maybe it worth increasing the contest time a little?

»
5 лет назад, скрыть # |
 
Проголосовать: нравится -26 Проголосовать: не нравится

Hope this contest will bring good luck to me in CSP-S 2021 (1st round) tomorrow :)

P.S. If you don't know what CSP is click here

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

HardCoder

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

For me C/D was too hard according to previous :(

Ho to solve D ?

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

The implemention of E and F was so painful (at least for me) !!!!!

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

Can someone share a neat implemeantaion of pE?

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

For me the gap from D to E was big. Solved A-D in like 30 minutes, than did not found any clear idea for E or F.

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

How to solve G — Propagation?

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

    Similar to brute force approach. The bottleneck of the brute force approach is when x has a lot of neighbours, updating all the neightbours will take long. So we need to deal with these type of nodes separately.

    Call a node x big if the number of it's neighbours is >= sqrt(2e5). There are very few nodes of this type. So, the idea is to maintain an array of pairs last_propagation for the big nodes. If qi is the last query when a big node b appeared as a query, then last_propagation[b] will be equal to (value of node b at that the time of the query, qi).

    We also always keep the values of these big nodes updated as we process each of the queries sequentially. But we're fine if the values of the small nodes are not always kept updated, since it won't take long to get their latest value using the last_propagation array.

    Then, to process the queries, consider two cases:

    • If x is big, update it's last_propagation and also update it's big neighbours' values.

    • If x is small, get it's latest value and then update all it's neighbours the brute force way.

    Here's my submission using this idea. Let me know if I need to clarify anything above.

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

DELETED

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

how tf solve A? I have 1 WA and can't get what's wrong...

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

Why does this not work for G? (35x AC, 2x WA)

Split nodes into "light" (degree $$$\lt \sqrt{m}$$$) and "heavy" (degree $$$\geq \sqrt{m}$$$).

For each node we additionally keep track of all adjacent heavy nodes.

For light nodes, we directly push the result of a query to all of its neighbors after a query.

Additionally for all nodes (heavy or light), when we have a query, we will check for any newer values from heavy neighbors.

Remember to perform a heavy neighbour pull at the end for all nodes before printing the answer.

This takes a total of $$$O(m + (n + q) \sqrt m)$$$ since there can be at most $$$\sqrt{m}$$$ heavy nodes in the graph by definition.

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

lol i hate geometry problems

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

I need to go debug my E. My basic idea was to represent the board as a bitmask try all 2^16 bitmasks and check a) Do i cover the required cells? b) Are the cells i have connected? (used DSU) c) Does my polygon have any holes? (used DSU) d) Do i have any self intersections (i.e. corners where one pair of opposite diagonals are included and the other pair where there are not)? However, even on the sample, I'm coming up short on the count, so I'm overkilling boards somewhere.

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

    You don't have to use DSU for checking holes. You can simply do a bfs starting from an edge square that is empty and check if you can visit all empty squares without leaving any behind

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

    What do you mean by "self intersections", I did the following in my AC code:

    A mask is considered good iff:

    • The selected nodes are connected and cover all $$$(i, j)$$$ with $$$a_{i, j} = 1$$$
    • All non-selected node components consist of at least one boundary cell.
    Code
    • »
      »
      »
      5 лет назад, скрыть # ^ |
       
      Проголосовать: нравится 0 Проголосовать: не нравится

      Thanks. I must have a bug in my connected checker, as I agree that the self intersections check SHOULD not be necessary. I agree on the "hole-check" piece with you. I guess I'll go use it to discover my bug elsewhere, as it shouldn't be flagging anything.

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

        Finally found the bug: i<15 vs. i<16 in for loop termination condition. Painful :(.

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

        Attatching GO code here:

        Code
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +22 Проголосовать: не нравится

God save me from tasks like this E. Only you and its author know which moat is considered correct.

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

Can someone help me with D) . I used knapsack . why is it wrong ?

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

How to solve D, I got the easy $$$O(n^{4})$$$ dp, optimized it like hell for it to pass. What was the $$$O(n^{3})$$$ idea?

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

Please someone explain why this comparator doesn't work? for C.


bool co(const string s,const string t){ p=sz(s),q=sz(t); i=0; while(i<min(p,q) and mp[s[i]]==mp[t[i]])i++; if(i<min(p,q) and mp[s[i]]<mp[t[i]])return true; return false; }
»
5 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

This is my code for problem D, can somebody give me a counter test for this code? I got 40/50 test passed at atcoder.

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

problem D — can anyone guide me where my logic getting wrong? top-down implementation

Spoiler
»
5 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

I immediately related to Xenia and tree the moment I read problem G. Kudos to the authors for a really educative problem.

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

How to solve Problem G?

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

I feel like E is a little easier than D, because I think D is related to DP while E is related to brute-force.

After some observations, you can figure out the solution to E, but for a beginner coder like me, I just couldn't figure out a way to solve D.

Even though I didn't solve E in time, I still feel happy that it's at least solved in the end.

Here's my video during the contest.

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

Pretty boring, expected better from an ABC round :/

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

Alternate solution to $$$G$$$: We keep a bucket of size $$$\leq \sqrt{M}$$$ that stores {vertex, update_value} pairs that we haven't updated in the graph yet. When the size of this bucket becomes $$$\sqrt{M}$$$, then we iterate through every element in it and update the whole graph correspondingly. When we add a new vertex to the bucket, then search through each element in the bucket and find its updated value based on that. Total time complexity should be $$$O(N + Q\sqrt{M})$$$ or something, but my code is still TLEing on some cases. Is it because of using ordered_set?