dalex's blog

By dalex, 2 months ago, translation, In English,
 
 
 
 
  • Vote: I like it  
  • +88
  • Vote: I do not like it  

»
2 months ago, # |
  Vote: I like it +13 Vote: I do not like it

Can I register with my team? Or only individual contestants?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    You can, but people on the onsite contest played individually.

»
2 months ago, # |
  Vote: I like it +4 Vote: I do not like it

Will there be an editorial after the contest. It becomes really hard to get solutions for all the problems from the comments for beginners like me.

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I enjoyed the contest, the problems were really interesting. Can I see the case I'm failing at on problem M?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    This test has n = 3.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      I'm like brute forcing, so maybe it's some logical bug.

      Can you share the full test? :)

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can someone share his code for C.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +2 Vote: I do not like it

    Code

    I'm not sure how clear it is but I can explain anything if it's unclear.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Could you please explain how your code works. This is my Code. The Idea is same as yours I guess but its giving wrong answer on Test 11.

      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it +2 Vote: I do not like it

        I start by sorting the ranges by their end points. Then as I'm processing the end points, ill greedily build my set.

        Basically, if by the time I get to the end of some range and there's no number in my set (that's the ceiling() call) that belongs in it's range, then I'll add that range's endpoint to the set.

        This is always optimal because I'm going in increasing order of endpoints so every time I add a number to my set, it's as large as possible so it's most likely to fit in the other ranges (who all have end points greater than the current one).

        • »
          »
          »
          »
          »
          2 months ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          Why I sort the ranges by their start points then I got wrong answer ? But sort the ranges by their end points will get AC ?

»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Any hint for problem H or L???

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

    Problem H:

    BFS off of every monster tile and only go a maximum of d distance away. Any tile that was touched by a monster's BFS is now no longer usable. Now BFS from your starting point and do regular shortest path in a grid but making sure to ignore cells touched by the monsters.

    Problem L:

    For every position i in the string, find the next position of every letter in the alphabet. Now keep some kind of queue and find the next position of whatever letter is queried (or pop the back of your queue). If the next position of the queried letter doesn't exist, the answer is no otherwise it's yes.

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      So simple BFS's were enough in H? I thought that with n*m up to 4*10^10 that would take too long, even just to calculate 'bad' cells

    • »
      »
      »
      6 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      For H,first i DFS for each 'M' finding which grid can't reach, then BFS for shortest path, but wrong answer on test 20,i really wanna know what test 20 data is,thx~

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

What's output of problem E for this test case: abaca aabac

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

What is the test 48 on F?

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

    During the contest this test helps me:

    4
    3 2 3 4
    1 4
    1 4
    0
    

    Answer is NO

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Any hints on how to approach I? My approach can't seem to get past test 12.

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +3 Vote: I do not like it

    I used this approach:

    Define a procedure findRoot(vertices, leafs, depth) for search a tree root among vertices, inside it we need to find two leafs from a different subtrees (relative to root). It can be managed in O(size(vertices)), then you can easily find a root (it is a vertex, that dist(leaf1, v) = dist(leaf2, v) = depth). Then you need to run findRoot recursively from left/right subtree.

    So, each findRoot procedure takes 2 * size(vertices) queries (2 * nlogn in total) and additional queries at start to find leafs.

    • »
      »
      »
      2 months ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      That makes a lot of sense. Thank you!

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

      Hi, I can't figure it out how do you manage to classify vertex according to left and right subtree for the recursive call. Can you explain that part? Because you pass vertices and leafs parameters that, I guess, represent vertices and leafs of the current subtree.

      Thanks

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        You have two leafs from different subtrees, so lets call them left & right. So to classify arbitrary vertex we need to compare dist(left, vertext) and dist(right, vertex) — if dist from vertex to left vertex smaller then vertex in a left subtree and vice versa.

    • »
      »
      »
      4 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Could you show me the code? I try many many ways but i still can't figure it out.

      Thanks.

      • »
        »
        »
        »
        4 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        It's very easy to include interactor in the solution and test it locally. All tests for this problem are just trees with random-shuffled vertex indices (there are no any special cases). So it doesn't seem you "tried many many ways".

        • »
          »
          »
          »
          »
          4 weeks ago, # ^ |
            Vote: I like it 0 Vote: I do not like it

          That's because I make too many queries then I get a wrong answer,but i have no idea how to reduce the query though I know my ways can restore the tree.

          • »
            »
            »
            »
            »
            »
            4 weeks ago, # ^ |
              Vote: I like it 0 Vote: I do not like it
            Spoiler
»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

What's test 22 on H ?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it +9 Vote: I do not like it
    Test 22 generator
»
2 months ago, # |
  Vote: I like it +29 Vote: I do not like it

The game .C.O.N.T.E.S.T: Unexpected Behaviour from Problem K "Video Reviews" does not exist. But recently our gamedev team Veslo Games released the game .T.E.S.T: Expected Behaviour (from creator of Codeforces Simulator!) to the Steam Early Access. If you like puzzles, consider checking this out!

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

is there a algorithm about problem M?or it's just a simulation?

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    Spoiler, M
»
2 months ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

Can any body help me for problem C ?? I can not find the algorithm. And Why (2 _ 1 5 ) is a wrong answer on test_case 1 for problem C.

»
7 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

could anybody help me with the problom I, I can't pass the test 5

  • »
    »
    7 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    This test has n = 7 and random-shuffled vertices.

    • »
      »
      »
      7 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      thanks a lot,but i'm stuck in test 12 now, trust me,i will figure it out :( lol

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

I am stuck on problem H 8-th test . Can I see the case I'm failing ?

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Can anyone provide any hints for problem K ,video reviews? thanks.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Main hint: binary search

    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      thanks for replying.binary search i figured out but was not able to come up with a predicate.thanks.

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Suppose we have X, and we need to check if X is enough to get m reviews. You need to process the bloggers from left to right. There are two options:

        • blogger is already interested in the game — just increase reviews count
        • blogger isn't interested in the game — you need to convince him (if already convienced count < X) and increase reviews count.

        It can be easily proven that greedy algorithm works.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

What is the test case 50 in problem F? I got stucked there :(

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it
    F, test 48
    F, test 50
    • »
      »
      »
      5 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      Thanks, I don't know why my aproach was wrong. At the end I changed my strategy and get AC.

      Do you have any hint for problem D? I belive that a maxflow algorithm could said if it is possible or not, but I can't construct the solution

      • »
        »
        »
        »
        4 weeks ago, # ^ |
        Rev. 2   Vote: I like it 0 Vote: I do not like it
        Certificate in D
»
4 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

What is the test case 52 in problem F? I got stucked there.

  • »
    »
    4 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    The same as test 48 (see my comment above), but with different random seed

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

What's the approach for 'L — Queries on a String'? My current solution exceeds the memory limit at test 7.