Palindrome dài nhất
View as PDF
Submit solution
Points:
0.29 (partial)
Time limit:
1.0s
Memory limit:
256M
Input:
stdin
Output:
stdout
Problem source:
Problem types
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch
Cho xâu ~S~.
Tìm độ dài của xâu con (liên tiếp) đối xứng dài nhất.
Input
Dòng ~1~: Số nguyên dương ~N \leq 5 \times 10^4~.
Dòng ~2~: Xâu ký tự độ dài ~N~.
Output
1 dòng duy nhất gồm độ dài của xâu con đối xứng dài nhất.
Sample Input
5
abacd
Sample Output
3
Comments
Bài này O(N^2) vẫn AC nhé, solution khác là có thể dùng sliding window để làm bài này
* Mình xin góp 1 ý tưởng cho những bài chưa nghĩ ra cách full ạ*
xâu đối xứng dùng manacher
=))
This comment is hidden due to too much negative feedback. Show it anyway.
Gợi ý
This comment is hidden due to too much negative feedback. Show it anyway.
bài này có ver2 không ạ em code O(n^2) vẫn AC ;-;
chắc test yếu, ô cứ đắp 10^6 chữ a là ok (")>
chắc test yếu, ô cứ đắp 10^6 chữ a là ok (")>
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
hihi
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
Tại hàm độ dài max không đơn điệu ý bạn, phải cnp các độ dài chẵn riêng và lẻ riêng Bài này bạn có thể làm bằng manacher, mình thấy dễ hơn, tài liệu thì ở đây: https://vnoi.info/wiki/algo/string/manacher.md
cho mình hỏi tại sao phải chặt nhị phân chẳn lẻ thế ạ
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
Hash base 31 AC được nè :V
Code kiểu j v :>>
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
Tại sao lại k nhỉ
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
Cảm ơn bạn PPAP_1264589 đã đóng góp 3 test khá mạnh cho bộ test của bài này <3. Mình đã rejudge lại toàn bộ submission AC và lần này không chỉ có một vài mà lên đến khoảng 70 submissions đã mất AC :(.
This comment is hidden due to too much negative feedback. Show it anyway.
Mình vừa thêm 1 test do bạn manhtranVN đóng góp, và có vài submission đã mất AC.