yazan_istatiyeh's blog

By yazan_istatiyeh, history, 18 months ago, In English

[problem:451364A]

Idea: yazan_istatiyeh, prepared: noomaK

Tutorial
Solution
Rate the problem

[problem:451364B]

Idea: DeadPixel99, prepared: noomaK

Tutorial
Solution
Rate the problem

[problem:451364C]

Idea: noomaK, prepared: noomaK

Tutorial
Solution
Rate the problem

[problem:451364D]

Idea: noomaK, prepared: noomaK

Tutorial
Solution
Rate the problem
Bonus

[problem:451364E]

Idea: noomaK, prepared: yazan_istatiyeh

Tutorial
Solution
Rate the problem

[problem:451364F]

Idea: yazan_istatiyeh & noomaK, prepared: yazan_istatiyeh

Tutorial
Solution - 1
Solution - 2
Alternative solution
Rate the problem

[problem:451364G]

Idea: noomaK, prepared: noomaK

Hint 1
Hint 2
Hint 3
Tutorial
Solution
Rate the problem

We hope you enjoyed the contest and benefited from it, and would love to hear your feedback:)

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

| Write comment?
»
18 months ago, # |
  Vote: I like it +7 Vote: I do not like it

Nice Problem-set guys. <3

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

Excited for the next rounds,thx for the preparers

»
18 months ago, # |
  Vote: I like it +12 Vote: I do not like it

Maximum manhattan distance can be calculated in $$$O(k)$$$ for $$$k$$$ given points in the problem D. My Submission

»
18 months ago, # |
  Vote: I like it +3 Vote: I do not like it

interesting problems and very good tutorial, well done guys.

»
18 months ago, # |
  Vote: I like it +1 Vote: I do not like it

good collection of problems keep coding!

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

Can you please open the solutions ?

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

Nice problems set :3

»
18 months ago, # |
  Vote: I like it +1 Vote: I do not like it

Good Problem-set. Waiting for next round

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

In F. The solution by noomaK. I don't understand why we're multiplying by 4 instead of 2 in the step:

ans -= d * 4ll * sum;

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

    2 from the original equation, and 2 cuz the pairs are unordered so we multiply by 2 to make them ordered.

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

not able to understand F editorial can anyone explain better how to find lcp over all pairs using trie

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

    Let's imagine the trie as graph, for any two string their lcp node is the lca of the two nodes that represents their final character.

    Knowing that, now we need to count for every node in the trie how many pairs this node is the lca.

    For a node $$$u$$$ to be the lca of two nodes $$$a$$$ and $$$b$$$, $$$a$$$ and $$$b$$$ should be in the subtree of $$$u$$$ and $$$a$$$ should be in a subtree of a different child of $$$u$$$ than $$$b$$$.

    To count the number of pairs for each node, we can traverse the children of $$$u$$$ in any order and keep the count of terminal nodes we've seen so far in other subtrees other than this child, and add the contribution from this child with other visited children.