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

Автор tril0713, история, 5 недель назад, По-английски

My solution: each bit is independent so let us consider them separately.

Now notice that if the first row and colmn are already filled, the whole grid is uniquely determined.

Use a dsu to maintain the equality relationship between the positions and the final time complexity is $$$\mathcal O((n + q) \log V \alpha n)$$$.

I have tested the code in mashups and it runs 2499ms, which means that the constant is too big. Can any one help me to optimize the code?

Code
  • Проголосовать: нравится
  • +20
  • Проголосовать: не нравится

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

z = (oz >> i) & 1;
Instead of maintaining $$$\log V$$$ DSU, you can maintain just 1 DSU and maintain z as 30-bit integer instead of 1-bit integer.

285717430