atcoder_official's blog

By atcoder_official, history, 2 years ago, In English

We will hold Sky Inc, Programming Contest 2023 (AtCoder Beginner Contest 329).

We are looking forward to your participation!

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

| Write comment?
»
2 years ago, hide # |
 
Vote: I like it +13 Vote: I do not like it

I <3 AtCoder. When I visit Nihon, I want to visit AtCoder office.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Completely clueless on E :(
Saw 3 WAs of Forested, got demoralized further.

»
2 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

today's D realize me, how poor I am in building logic :(

  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it -27 Vote: I do not like it

    If you know segment tree you can do it easily.

    Code
  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    you could have just solved it using heaps tho

    • »
      »
      »
      2 years ago, hide # ^ |
       
      Vote: I like it +1 Vote: I do not like it

      Array is enough. One additional variable to keep track of smallest id, You can just keep track of largest one yet on-line. Like the maximum subarray problem, but not exactly.

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can we solve F using bitsets?

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Harder version of problem E (with outputting the operations)

Here from Coding Ninjas.

»
2 years ago, hide # |
Rev. 2  
Vote: I like it +3 Vote: I do not like it

E is just a modified DP version of this problem (but it took me too long to recognize that)

Not a bad problem though

  • »
    »
    2 years ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    please elaborate

    • »
      »
      »
      2 years ago, hide # ^ |
      Rev. 3  
      Vote: I like it 0 Vote: I do not like it

      We want to build a string $$$S$$$ and in this case our "dictionary" contains $$$\frac{m(m + 1)}{2}$$$ strings (some of the substrings of $$$T$$$ might be the same).

      The only difference between Word Combinations and today's problem is that some prefix of $$$S$$$ should be a prefix of $$$T$$$ and some suffix of $$$S$$$ should be a suffix of $$$T$$$ as well (not just any string from the dictionary). After this the problem is reduced to the cses problem, also we don't even need a trie to solve it, brute-forcing all substrings of $$$T$$$ at each position works as well due to a small $$$M$$$.

      P.S. I just call every check if some target is reachable with given parts problem a knapsack problem, not actually sure if that is accurate

      • »
        »
        »
        »
        2 years ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        Can I see your code? How does your solution handle this?

        Input:
        6 3
        aaaccc
        abc
        
        Output:
        No
        
        • »
          »
          »
          »
          »
          2 years ago, hide # ^ |
          Rev. 3  
          Vote: I like it 0 Vote: I do not like it

          It's not the prettiest piece of code that I've written, but it works

          Spolier

          Here state 1 means that some suffix of $$$T$$$ has matched fully. If before some suffix hasn't matched fully — I need to start with a fresh prefix

          Not sure if I actually need the extra 0-1 dp state, maybe just checking that a prefix and a suffix have matched is enough

          • »
            »
            »
            »
            »
            »
            2 years ago, hide # ^ |
             
            Vote: I like it +1 Vote: I do not like it

            Ah, okay. Now I see why it works, it seems like your explanation before wasn't complete.

            I wouldn't suggest calling this knapsack dp since it isn't that — it's just dp. People will get confused and you'll need to explain further. And also, your solution didn't actually reduce to Word Combinations since you need the check with fully matched suffixes, but I admit that the solutions are still quite similar.

            • »
              »
              »
              »
              »
              »
              »
              2 years ago, hide # ^ |
               
              Vote: I like it +10 Vote: I do not like it

              My bad, the explanation was incomplete indeed. The similarity with Word Combinations only occurred to me after the contest has ended and I was frustrated with myself that I didn't see the correlation earlier

»
2 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Passed ABCDF in 19min, but E was always WA x 1 :(