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

Автор viking_34, история, 10 месяцев назад, По-английски
  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

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

https://codeforces.com/problemset/problem/1600/F is a very easy 2300 problem.

Solution summary
»
10 месяцев назад, # |
  Проголосовать: нравится +21 Проголосовать: не нравится

10D — Pretty obvious dynamic programming solution for 2800.

896E — Brute force approach works.

911G — Brute force approach works.

484E — Brute force approach works.

580E — Brute force approach works.

914F — Bitset solution works.

3D — Not a difficult greedy problem.

840D — Mo + random approach works.

755F — Knapsack solution with a famous trick.

Maybe there are solutions that respond to the rating, but there exist solutions that make the problem much easier, too.

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

    Thank You for the effort , it will be helpful for the community.

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

    Add this to the list 1838E - Count Supersequences, I found it easy.

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

      Sure sir !

      • »
        »
        »
        »
        10 месяцев назад, # ^ |
        Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

        Just saw you had that there already. Thanks for acknowledging regardless.
        P.S. — Just realized, you might have added it after my suggestion, at-least it was useful then.

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

          Can you paste your code here and expalin it please ,I am not able to understand the editorial i tried a lot

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

            I too did not get it

          • »
            »
            »
            »
            »
            »
            10 месяцев назад, # ^ |
            Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

            Instead of counting the number of arrays of length $$$m$$$ which have $$$a$$$ as a sub-sequence.
            We will count the number of arrays which DO NOT have $$$a$$$ as their sub-sequence (read the last paragraph before the "Note" to understand why this cannot be done to find the answer more directly) and subtract that from the total number of arrays (of length $$$m$$$).
            There are a total of $$$k^m$$$ arrays of length $$$m$$$ (since each element can be anything from $$$[1,k]$$$).

            To find the number of sequences which don't have $$$a$$$ as their subsequence.
            We can go ahead and count the number of arrays $$$b$$$ which have prefix of $$$a$$$ till length $$$i$$$ (and sum up for all $$$i$$$ in $$$0$$$ to $$$n-1$$$).
            To do this we shall choose $$$i$$$ spots out of $$$m$$$ for placing first $$$i$$$ elements of $$$a$$$.
            To help with understanding, say the $$$i$$$ spots are $$$p_1$$$, $$$p_2$$$$$$...$$$$$$p_i$$$ (in increasing order).
            Till I reach $$$p_1$$$, I will not place any element equal to $$$a_1$$$, leaving only $$$k-1$$$ choices for each spot. Once on $$$p_1$$$, I will assign it the value $$$a_1$$$ in $$$1$$$ way. then proceed to not assign $$$a_2$$$ to any element till I reach $$$p_2$$$ (in $$$k-1$$$ ways per spot) and so on.
            The number of ways to choose are $$${m}\choose{i}$$$ and the ways to assign values for all such selections ($$$m-i$$$ in total) are $$$(k-1)^{m-i}$$$
            we are to find:-

            $$$k^m - \sum_{i=0}^{n-1}\binom{m}{i}.(k-1)^{m-i}$$$

            One can use inverse modulo ideas and the fact that $$$\binom{n}{r} = \frac{n-r+1}{r}.\binom{n}{r-1}$$$

            Solution


            Why not directly do it? (the note before the "Note")
            If you tried to find the arrays such that $$$a$$$ is a subsequence directly. You might want to choose $$$n$$$ spots out of $$$m$$$. but say the largest chosen element is $$$p_n$$$. now for all indexes in $$$b$$$ greater than $$$p_n$$$ (the array we are constructing) you can place any number out of those $$$k$$$. so the power of $$$k$$$ is heavily dependent on $$$p_n$$$ (there will be some $$$(k-1)$$$ terms too) which is not easy to deal with (we are choosing all sorts of elements, so, keeping track of the highest element and computing based on it isn't easy!)

            Note — I am not familiar with writing using LaTeX or anything, neither do I know how to align stuff here.
            Inconvenience is regretted.

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

          Yes , I have added it after your suggestion.

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

    For problem 896E, maybe at the time of your submission it has weaker testcases, now it's showing TLE for brute force.

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

problems in difficulty range 1500-2000 are better since many people try to solve them.

»
10 месяцев назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

https://codeforces.com/contest/1255/problem/D

No way this can be a div2 D and 1700 rated.

Idea