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

Автор Radewoosh, история, 7 лет назад, По-английски
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Разбор задач Hello 2019
  • Проголосовать: нравится
  • +127
  • Проголосовать: не нравится

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

thanks for the tutorial!

How to split sequence into |LIS| decreasing sequence in E?

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

where does the Youtube tutorial go? :/

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

For 1097D why is the result multiplicative?

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

    If you calculate the expected value for a given n with k = 1 (one step), you see that the answer is simply σ1(n) / σ0(n), where σ1(n) denotes the sum of divisors of n and σ0(n) the number of divisors.

    It's well known that σ1 and σ0 are multiplicative functions (and easy to prove indeed). So, it's easy to see from there using induction that the function is multiplicative.

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

    I wasn't sure when I was in the contest, so I used DFS to search all the divisors of n, the complexity is correct.

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

    E[f(X)g(Y)] = E[f(X)]×E[g(Y)], if X and Y are independent. Here exponents of each prime divisor of N are independent of each other, and E(.) denotes the expectation value.

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

can anyone help me with problem B

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

How to calculate dp(k,j) in problem D.

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

In my opinion, posting fast such editorials without tutorials of some task is muuuch better

It gives time for problemsetter to write missing ones clearly and others an oportunity to read available parts and try to understand them

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

in problem c " The task is to connect some of them into ordered pairs so that each bracket sequence occurs in at most one pair and the concatenation of the bracket sequences in each pair is a correct bracket sequence". Can someone explain me the solution of c in context of the bold statement above.if we want each bracket sequence occur in at most one pair then how is the editorial solution is correct. for ex if sequences given are : "((,)),)())" then solution according to the editorial will be 1 but there will be one sequence left with no pair which violates the condition in the bold statement.Can someone clarify my doubt

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

For 1097B, how to solve it if N is bigger?

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

How to solve G?

I came up with an idea that we can calculate the number of ways to choose k edge(s) from n-1 total edges, and for each way we calculate the number of the set of vertices which satisfies the condition(for every edge we chosen, there is at least one vertex(in the set) in both sides of the edge).

And that is the answer. Maybe can use DP on tree to solve it.

Because f(S)^k <--> choose k edge(s), that's equivalent.

Am I right?

sry for my poor English, wish you can understand me...

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

    My idea is similar but not same with yours.

    First we can use Stirling number to split power into several falling factorial,e.g

    f(S)^k=sum{i=1...k}S(k,i)f(S)_(i),where x_(i)=x(x-1)...(x-i+1)=C(x,i)i!

    then we should compute sum C(f(S),i), for every 1<=i<=k.

    this is equivalent to choose i egdes and sum the number of sets valid(that means f(X) includes these edges).

    then we can DP with dp(i,j) means choose j edges in i's subtree, and each egde chosen has at least one node of its subtree in the vertex set. and then the answer is dp(1,i) minus unvalid ways, the latter is only possible when (j-1) edges are all in the other's subtree(and no vertex outside this subtree is in the set). you can enumerate the "highest" edge, and the ways of this can be easily gotten use dp values.

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

I think problem C somehow matches to 990C - Bracket Sequences Concatenation Problem of previous codeforces contest ....

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

Could someone mind explaining to me why this solution for problem E doesn't work?

My approach is the same as described in editorial, except that I remove from list the maximum between LIS and LDS.

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

    Unfortunately, that's just not efficient enough. That solution gives you sequences, but you need around .

    The key to the solution is that, if the LIS isn't long enough, we take the entire set of decreasing subsequences, not just the longest decreasing subsequence. Note that in general, repeatedly removing the longest/last decreasing subsequence doesn't give you the minimum cover: consider 3 0 4 2 1: you might want to take 3 2 1, but the only minimal cover is 3 0 and 4 2 1.

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

      Hmmm I'm still not fully sure I understand since at every single step I take the max between LIS and LDS, then shouldn't that mean that at least one of LDS or LIS should have size bigger K, for the case mentioned my code would work since if it takes 321 as LDS, then it would find 04 as LIS on the next step.

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

        I don't have a case on hand which breaks it. Unfortunately, it's not true that either the LDS or the LIS has size at least K: see the sequence 3 6 9 2 5 8 1 4 7: both the LIS and LDS have size 3, but K = 4.

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

          But in that case 3 is fine, because its length is 9, not 10 and 6 is doable in 3

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

          So I get what you mean which is that in the worst case you will find that LIS and LDS are both sqrt(N), so its possible that there is some sequence where by taking sqrt(N) every time instead of sqrt(2*N) it will require more iterations :S

          It just seems very hard to find such case...

          I tried to find a test which breaks my solution so I ran a program which tested all 9! permutations for N=9 in my code and all of them passed with K<=3, so if there is a case that breaks it it's at least N=13...

          Also, do you have any idea on how you would demonstrate that the complexity of my proposed solution is 2*sqrt(N)? I did a this very simple code, and it plots approx 2*sqrt(N), but I don't know how to demonstrate it formally:

          function f(N) { // 10=> 4, 100=>16, 10000=>193, 1000000=>1990
            var ret=0;
            while(N) {
              N-=Math.ceil(Math.sqrt(N));
              ret++;
            }
            return ret;
          }
          

          After adding the condition if len<K grab the decreasing sequences LCS generated my code passes.

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

Hey I need some explanation for problem D, how to calculate the DP states, otherwise the solution is understandable.

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

Can anyone explain in problem F Inclusion-exclusion. I don't understand the moment, that (i / x) is square-free.

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

Er

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

can anyone explain how to calculate dp[k][j]? I find it hard because dont we have to calculate gcd between dp[k][j] and p^j??

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

May be this is my personal problem, but the value of k was misleading for me, if it was 106 imo it will be better. For this value of k I wrote dp solution without knowledge of multiplicative function and it was very close to tl (about 3s on maxtest). When I wasted a lot of time I finally wrote correct solution, but this is D on div1+div2, so such trap is not good.

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

In problem D, can someone please explain the recurrence of the DP.

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

Anyone knows of any other problem similar to problem D?

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

In problem F, I dont understand why operation 3 is bitiwse AND ?

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

Please link this editorial to contest.

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

Hint for G?

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

I wrote a tutorial of problem G. https://mirror.codeforces.com/blog/entry/64367

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

The first editorial is formatted so much better than the second. Thank you for both, though! :D

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

For problem E, how to guarantee this partition which calculates the smallest k

(Ah...I make a mistake, just forget the problem above

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

Perhaps irrelevant, but is there a sequence on OEIS for the term f(n) in problem E?

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

why in problem C, about brackets, answer is 2, but not 3?

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

soon™

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

Why are the editorials not linked with questions nowadays?

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

Seriously, what is the record for the latest tutorial for some problem? We're close to three weeks now.

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

In F,"instead of storing the parity of numbers equal to x, store the parity of numbers divisible by x." Is it divisible by X or divisors of X??

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

How can we solve this problem using Dynamic Programing, there is dp tag given to this problem. I am a beginner so could someone help me with this ....

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

I am 5 years late but in B you can bitmask from 0 to (2^n)/2-1 instead of 0 to 2^n-1. all combinations from (2^n)/2-1 to (2^n)-1 are the same as the combinations from 0 to (2^n)/2-1 just different signs