dragoon's blog

By dragoon, 10 years ago, In English

There will be online version of the ACM ICPC Phukhet Regional 2013 tomorrow 14:00UTC time. It will be 5 hour contest. You are cordially invited to participate in the contest. Hope you will enjoy the set!

Here is the contest link

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

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

Anyone has hints for H? I tried Gaussian Elimination for each query but it was too slow.

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

    The constraint on N was small, so a backtrack or bitset DP of some sort should work.

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

      How do you handle repeating vertices?

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

        That was just a wild guess. Not like I coded anything... (I did the first 1.5 hours of this, then today's CF round and realized that it won't do me any good to train much with no actual competition in sight :D)

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

    We can precompute some special inverse matrix in advance and answer each query in O(n2). This matrix seems to be depend on t but precomputing n matrices still gets TLE. Then I try the same matrix for all t and it passed. I have no idea why :)

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

      I guess, since t is O(n), so generate O(n) matrices each of size O(n^2). And also do the gaussian elimination in O(n^6) per matrix to answer each query O(1). Am I mistaking?