chokudai's blog

By chokudai, 3 years ago, In English

We will hold AtCoder Beginner Contest 247.

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

We are looking forward to your participation!

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

| Write comment?
»
3 years ago, # |
  Vote: I like it +28 Vote: I do not like it

fun contest

i thought F is a dp problem, realizing it's related to graph in the last minutes made me took a wild guess and speedrun coding DSU. submitted 8 seconds before contest ended and as expected got WA

»
3 years ago, # |
  Vote: I like it +14 Vote: I do not like it

I think I overcomplicated most of my solutions :/ But still it's wonderful, when there are various approaches to a problem. Great contest)

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

WA (https://atcoder.jp/contests/abc247/submissions/30857193)

AC (https://atcoder.jp/contests/abc247/submissions/30873457)

I think both are same in multiset of string

auto it=s.find(x) s.erase(it)  (WA)
s.erase(s.find(x)) (AC)
  • »
    »
    3 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    if a[i]==b[i] your code might fail because you remove elements twice.

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

      sorry,i didn't understand can you please elaborate

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

        For the case a[i]==b[i] the one solution removes two elements from the mulitset, the other solution tries to remove one element twice.

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

how to solve E?

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

    Iterate over all possible right endings. For each endings, we find the first X, Y, bad to the left. (Here we define a number bad as $$$(a[i] < Y || a[i] > X)$$$ If the order is one of the following (X, Y, bad, right), (Y, X, bad, right), (X, bad, Y, right), or (Y, bad, X, right), it is impossible to find a subsequence ending at right that contains both X and Y. If bad is leftmost relatively to X and Y, then the number of subsequences ending at right will be $$$min(index_X, index_Y) - index_{bad} + 1$$$ My submission

»
3 years ago, # |
  Vote: I like it +6 Vote: I do not like it

Why are heuristic contests shown in red on main atcoder page and in black color on contests page? I get it confused with Atcoder Grand contests because they are shown in red.

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

The solution to F?

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

    The idea is same as editorial but my dp states are a bit different. Please let me know if something is not clear.

    Spoiler
»
3 years ago, # |
  Vote: I like it +12 Vote: I do not like it

I find that Problems E and F in ABC round are always great practice for me. It turns out that it is quite a challenge for me to solve both of them within the contest. Hope that after more practice, I could be more comfortable with these problems.

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

Could anyone explain F. I'm unable to understand g(M)=f(M−1)+f(M−3) relation. Unable to understand "This problem is quite similar to “you must choose one of adjacent elements. How many ways are there to do so?” that we discussed right before." What is meany by adjacent elements? adjacent nodes or edges?

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

    Can't answer the first question . While solving problem I was looking for pattern and then brute forced for some values and found out that f[i]=f[i-1]+f[i-2] where i is the size of the cycle .
    For the second part , try naming each edge and vertex 0 to n-1 , u will notice that when you colour edge j , vertex j and (j+1)%n gets colored , I think this is exactly what is meant by the "you must choose one of adjacent elements. How many ways are there to do so?"

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

It was a very good contest.

can anyone tell me what is best time complexity in which problem C(1 2 1 3..) can be solved?

Link for Problem C

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

    Suppose that $$$T(x)=$$$ the number of numbers we should print when $$$N=x$$$, then we have $$$T(x)=2T(x-1)+1(x>1),T(1)=1$$$. So $$$T(x)=O(2^x)$$$.

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

    Someone solved it in O(1), because there are only 16 possibilities: Submission