Is there an editorial published somewhere? I have checked UTPC's official website but couldn't find anything. Would love to see some explanations for the harder problems. Participants' solutions can't be viewed, is this intentional too?
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Is there an editorial published somewhere? I have checked UTPC's official website but couldn't find anything. Would love to see some explanations for the harder problems. Participants' solutions can't be viewed, is this intentional too?
Recently, I have been reading up on few blogs about rolling hash: dacin21's [On the mathematics behind rolling hashes and anti-hash tests] and rng_58's [Hashing and Probability of Collision]. Both of them showcase different hashing technique.
Note: in the above equation a is the base
H(a) = (r+a_1)(r+a_2)...(r+a_n)
Note: in the above equation r is the base
Are there any differences between the two in terms of use-case and other parameters? Which one do you recommend? Also, if possible can you please share your implementation of rolling hash if you have ever used it to solve any problem. Thanks!
Can't understand how to solve this problem.
Find a permutation of a given sequence A with N elements, such that it is a max-heap and when converting it to a sorted sequence, the total number of swaps in maxHeapify of line 25 in the pseudo code is maximal possible.
1 maxHeapify(A, i)
2 l = left(i)
3 r = right(i)
4 // select the node which has the maximum value
5 if l ≤ heapSize and A[l] > A[i]
6 largest = l
7 else
8 largest = i
9 if r ≤ heapSize and A[r] > A[largest]
10 largest = r
11
12 if largest ≠ i
13 swap A[i] and A[largest]
14 maxHeapify(A, largest)
15
16 heapSort(A):
17 // buildMaxHeap
18 for i = N/2 downto 1:
19 maxHeapify(A, i)
20 // sort
21 heapSize ← N
22 while heapSize ≥ 2:
23 swap(A[1], A[heapSize])
24 heapSize--
25 maxHeapify(A, 1)
Source: AOJ
Name |
---|