tril0713's blog

By tril0713, history, 6 weeks ago, In English

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

Full text and comments »

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

By tril0713, history, 2 months ago, In English

Given $$$q \; (q \le 2 \cdot 10^5)$$$ operations:

  • Insert a pair $$$(a,b)$$$.
  • Given pair $$$(x,y)$$$, find the minimum value of $$$ax + by$$$.

$$$|a|,|b|,|x|,|y| \le 10^6$$$.

Full text and comments »

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

By tril0713, 7 months ago, In English

We call a string $$$s$$$ of length $$$n$$$ good, if and only if $$$n \bmod 2 = 0$$$ and $$$s[1,\dfrac{n}{2}] = s[\dfrac{n}{2}+1,n]$$$ (i.e. there exists a string $$$t$$$ that $$$s = t + t$$$.)

You are given a string $$$s$$$. For each $$$r \in [1,n]$$$:

  • Find all good substrings ending at position $$$r$$$.
  • The guess is: Their length can be divided into $$$\mathcal O(\log n)$$$ consecutive intervals.

Is the guess correct?

Full text and comments »

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

By tril0713, history, 10 months ago, In English
Problem statement

We transform the condition $$$s_i \ne s_{n-i+1}$$$ into if we change all $$$\texttt{0} \to \texttt{1},\texttt{1} \to \texttt{0}$$$ and reverse it to get a string $$$t$$$, $$$s$$$ is good if and only if $$$s = t$$$. Then we can use suffix array or manachar to get the answer.

Then, the hash solution did the same transformation and use hashing to get the answer with $$$\text{base} = 10^9+7$$$ and $$$\text{mod} = 2^{64}-1$$$ (unsigned long long). Can it be hacked? I have done stress test for $$$15000$$$ test cases :(

I will provide the hash code and the suffix array code below, if you need to make a stress test.

SA code
hash code

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it

By tril0713, history, 11 months ago, In English

Is there any extension which can change the submissions status such as changing Wrong answer on test X to Wonderful answer on test X? If it exists where can I find it?

Full text and comments »

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