BÌNH GIỮ NHIỆT CAO CẤP TOPGIA INOX 304, Dung Tích Lớn 500ML Thiết Kế Nắp Thông Minh Tiện Lợi Có Dây Xách Ly Giữ Nhiệt - ĐẠT QUY CHUẨN CỦA BỘ CÔNG THƯƠNG(BGN)
BÌNH GIỮ NHIỆT CAO CẤP TOPGIA ...
119.000₫ 180.000₫
Bộ 4 bàn chải đánh răng Nhật lông tơ mềm mại, Bàn trải đánh răng Than tre hoạt tính lông mềm, chải siêu êm bảo vệ nướu
Bộ 4 bàn chải đánh răng Nhật ...
43.000₫ 80.000₫

Bài tậpBài chưa trả lời

Https://lqdoj.edu.vn/problem/dplcs2

https://lqdoj.edu.vn/problem/dplcs2
1 Xem trả lời
Hỏi lại yêu cầu
99
Tham khảo câu trả lời từ Trợ lý ảo Lazi
I’m not able to open that link directly. Could you please share the problem statement here (paste the text), or at least describe:

- Input format and constraints
- What exactly to output (LCS length, number of LCS, count modulo something, number of distinct LCS, etc.)
- Any special requirements (time/memory limits, multiple test cases, reconstruction needed, large inputs, etc.)
- A sample input and output

If you’d like, I can provide a general solution template for common DPLCS-type problems. Here are a few possibilities and how I’d approach them:

1) Longest Common Subsequence length (classic)
- DP: dp[i][j] = LCS length of first i chars of A and first j chars of B
- Recurrence:
- if A[i-1] == B[j-1], dp[i][j] = dp[i-1][j-1] + 1
- else dp[i][j] = max(dp[i-1][j], dp[i][j-1])
- Optimization: O(nm) time, O(min(n,m)) memory with rolling arrays
- Simple reconstruction can be added if needed

2) Number of LCS (counting how many LCS sequences)
- You can extend the DP to count ways, being careful with duplicates:
- If A[i-1] == B[j-1], dpLen[i][j] = dpLen[i-1][j-1] + 1
count[i][j] = count[i-1][j-1]
- Else:
- if dpLen[i-1][j] > dpLen[i][j-1], take from top
- if <, take from left
- if equal, sum counts from top and left (and subtract from top-left if dpLen[i-1][j-1] == dpLen[i][j])
- This gets tricky to avoid counting duplicates; I can provide a robust version if that’s your goal.

3) Number of distinct LCS (unique sequences)
- Much trickier; typically requires careful handling to avoid duplicates, sometimes with sets or more advanced DP-with-next-array optimizations.
- I can tailor this if you confirm it’s the “distinct” variant.

4) Large alphabets or special constraints
- If strings are huge, we might need optimizations like bitset-based LCS (for binary alphabet or small alphabets) or patience/suffix-automaton tricks for variants.

If you share the problem text, I’ll tailor a precise solution (with code in C++, Python, or Java) to match DPLCS2’s exact requirements.
1 trả lời
1
1
Yamamoto Hitomi
04/11/2025 19:56:56
ko thấy câu hỏi =))

Mở khóa để xem toàn bộ nội dung trả lời

(?)
Bạn đã đạt đến giới hạn của mình. Bằng cách Đăng ký tài khoản, bạn có thể xem toàn bộ nội dung trả lời
Cải thiện điểm số của bạn bằng cách đăng ký tài khoản Lazi.
Xem toàn bộ Trả lời và Chat với Trợ lý ảo Lazi AI bằng cách Đăng nhập tài khoản ngay bây giờ
Tôi đã có tài khoản? Đăng nhập

Bạn hỏi - Lazi trả lời

Bạn muốn biết điều gì?

GỬI CÂU HỎI

Hôm nay bạn thế nào? Hãy nhấp vào một lựa chọn, nếu may mắn bạn sẽ được tặng 50.000 xu từ Lazi

Vui Buồn Bình thường
Combo 10 Đôi Vớ Tất Khử Mùi Kháng Khuẩn Cổ Ngắn Nam Nữ
Combo 10 Đôi Vớ Tất Khử Mùi Kháng Khuẩn Cổ Ngắn Nam Nữ
-50% 39.000₫ 78.000₫
Nước hoa ô tô khử mùi kháng khuẩn , Sáp thơm ô tô tinh dầu để xe hơi,Khử Mùi Hiệu Quả Có 6 Mùi Hương Phiên Bản Mới
Nước hoa ô tô khử mùi kháng khuẩn , Sáp thơm ô tô tinh dầu để xe hơi,Khử Mùi ...
-50% 15.000₫ 30.000₫
×
Mua sắm
+Gửi câu hỏi LAZI MALL
+500xu
×