| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3611 |
| 4 | jiangly | 3583 |
| 5 | strapple | 3515 |
| 6 | tourist | 3470 |
| 7 | Radewoosh | 3415 |
| 8 | Um_nik | 3376 |
| 9 | maroonrk | 3361 |
| 10 | XVIII | 3345 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 162 |
| 2 | adamant | 148 |
| 3 | Um_nik | 146 |
| 4 | Dominater069 | 143 |
| 5 | errorgorn | 141 |
| 6 | cry | 138 |
| 7 | Proof_by_QED | 136 |
| 8 | YuukiS | 135 |
| 9 | chromate00 | 134 |
| 10 | soullless | 133 |
| Name |
|---|



I can`t understend why answer is "1 2 3".
1 because {1}={2}, 2 because {3,1}={10,1}, and what is 3?
UPD. understood
3 because {1,2} = {4,5}
Maybe in KMP:
a[0]...a[i]...a[j]...a[k]a[0]...a[i]==a[j]...a[k]ifa[0]...a[i-1]==a[j]...a[k-1]anda[i]==a[k].a[i]==a[k]if and only if count of numbers which greather thena[i]ina[0]..a[i-1]is equal to count of numbers which greather thena[k]ina[j]..a[k-1].We can use the struct like segment tree, which help us get this count in
O(log(400000))(just +1 toa[i]when we add numbera[i]ans -1 else). If we getsuffix(a[j]..a[k-1])we don't forget to decrease all values which don't include to this suffix (it'sa[j]..a[h], ifa[j]..a[k-1]=a[j]..a[h]a[h+1]..a[k-1]). And first we should decrease all numbers as it possibly in any sequence because numbers are in the range1..2^32(then we can use a segment tree).I don't know is it correct solution, but maybe.
Yes, I did something like that for POJ 3167, using a BIT. But in that problem we only need to match one pattern. In SPOJ UNTITLED you need to match many patterns.
read the solution to ceoi 2011 Matching