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

Автор cgy4ever, история, 8 лет назад, По-английски
  • Проголосовать: нравится
  • +46
  • Проголосовать: не нравится

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

18 hours before this SRM.

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

Starts in 8 minutes!

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

I think admins should not count challenges of white accounts today.

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

How to solve hard? I've come up with per query but have no idea how to solve for all queries at once.

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

    Hint: Matrix * Matrix takes O(n^3), but Matrix * Vector only takes O(n^2). (Looks like al13n had the intended algorithm but unfortunately failed by overflow.)

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

life in codeforces: solve 3 problems, rank 500+ in div2; life in topcoder: solve 0 problems, rank 50+ in div1 :D

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

How to solve Div-2 B ???? :( :(

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

    I tried to solve like that:

    PowerEquationEasy

    But, for some reason it doesn't always work.

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

    Solution to the more general div 1 250: it can be seen from prime factorization that if a^b= c^d, then a= t^x and b= t^y for some t,x,y. Now you can just loop over all t and count the number of possibilities of (x,y). You don't need to consider because then x and y cannot be greater than 1.

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

Div1-250 was nice!

But a bit too hard for the Div1-Easy slot.

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

    Completely agree! I think that should have been scored as 300 but not 250!

    I honestly think that 250 scenario is: open and implement, the average score is about 200. Here we have only 3 coders with more than 200 points on it. And having that many people did not open 2nd (or open and had only 10 minutes to read and code it).

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

Count of the SRM time from the last 12 ones:

  • 9 PM: 6
  • 7 AM: 3
  • 11 AM: 2
  • 5:30 AM: 1

It would be nice if we can at least have have a more even distribution here.

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

    I did the math. I count 6 at 9PM and 6 at 5:30AM-11AM. Seems like a fair game to me.

    Or maybe you are right, it should be something like:

    • 7 PM: 2
    • 5 PM: 1
    • 10 PM: 3

    • 7 AM: 3
    • 11 AM: 2
    • 5:30 AM: 1

    Or you want less amount of contests in the first group?

    Topcoder is the only site that actually rotate the starting time to fit all time zones. Codeforces, Codechef, Hackerrank, Atcoder don't give a shit.

    And you know, there's some people living in the Americas and the 9 PM is good for them.

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

      In the past, it used to be splitted more evenly between 9PM, 7AM and 11AM. 9PM ones are usually those with least participants. I personally don't think it makes sense to shift more contests to 9PM and lose participation in result.

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

Can someone please explain solution for div 1 — 500, TIA.

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

    I'm not sure about my approach (couldn't get enough time to implement during contest), but some solutions looked like this:

    Start with bitmask dp, dp[1<<n][n] where dp[i][j] is the number of ways to traverse mask i, ending up (last traversal) at j.

    Recurrence relation should be dp[i][j]=sum(dp[i&(~(1<<j))][k] if k,j are set in i and it is possible to move from k to j. It is possible iff node x is visited (marked in i) only when complete subtree of x is visited or x lies on path from root to j.

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

    I got AC using the following approach. I use DP with state as (mask, current_vertex). I iterate over the next vertex nxt I will visit. If I do visit some particular vertex nxt, I will always return back to current_vertex only after ALL the vertices reachable from nxt, unvisited as of yet, get visited. So, for each pair (mask, current_vertex) I calculate the mask of all the unvisited-till-now vertices I will visit if I start at current_vertex (I store this in reachable[mask][v] in my code).

    So, I go from current_vertex to nxt, I add the product dp(mask|(1<<nxt), nxt)*dp(mask|reachable[mask|(1<<nxt)][nxt], current_vertex) to the answer. The first part of the product calculates the number of ways of dealing with nxt and the latter deals with the number of ways of dealing with the remaining unvisited neighbours of current_vertex.

    DP[mask][v] returns the number of permutations possible if I have already visited nodes denoted by mask and am currently at v.

    Code