freedom.9
Senior Member
Má nó mình chủ quan ko dùng cái template là for j in range(i, n) ở trong DP mà set nó thành dp(prevIndex, index) rồi tính frequency ở bên ngoài vì nghĩ là time complexity là như nhau.Em cũng chạy O(26*n^2) đây.
f[j] = min(f[j], f['i'] + 1) nếu như 2 đoạn từ 0 đến i và từ i+1 đến j là hợp lệ
Vẫn O(n^2)26 mà TLE loay hoay còn bỏ cả bài 2

RIP rank



).
can be non-standard and may cause unexpected issues, especially with standard library containers and iterators. Instead of using a C-style array, you can use std::vector<bool> for better compatibility and behavior:
.
