I was trying a problem on LCS topic and was stuck. It will be really helpful if anyone can provide me a hint to the problem.
Problem :-ADASEED
# | 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 |
I was trying a problem on LCS topic and was stuck. It will be really helpful if anyone can provide me a hint to the problem.
Problem :-ADASEED
Name |
---|
Auto comment: topic has been updated by humblefoolboi (previous revision, new revision, compare).
Hello Chauhan saab
$$$ \frac{N}{L} \le 100$$$ suggests that we can try out the pairing of same colors as they are fewer.
One solution would be to first make all pairs of same color (with pair I mean we want them at same position in our last sequence). If we want $$$x$$$ and $$$y$$$ to be at same position, then $$$\forall\ i$$$ where $$$ min (x, y) \le i\ \le max (x, y)$$$, $$$A_{i}$$$ and $$$B_{i}$$$ must be choped (supposing A and B the given two array). This would mean after forming all pair we should select some such that they don't overlap (while of course maximizing length) but probably it will TLE if we select literally all pairs.
For any index $$$i$$$ if we try finding other index $$$j$$$ from other array such that $$$i \le j$$$, I don't think it makes sense to try more than one as the smallest such $$$j$$$ should be better than rest surely so therefore we don't take all the pairs one for each (as a starting) from both arrays this might make it in time but not sure enough.
Just realized second part is pure crap. I does make sense to try more than one.