LIQ - Longest Increasing Subsequence (Ezz)
Xem dạng PDF
SUBMIT SOLUTION
ID:
baron_liq_1_ezzvcl
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Output Only, Pascal, PyPy, Python, Scratch, TEXT
(Giống bài LIS - Longest Increasing Subsequence (Nah), nhưng dễ hơn)
Cho một dãy số nguyên gồm ~n~ phần tử ~a_1, a_2, \dots, a_n~.
Biết rằng dãy con tăng đơn điệu là ~1~ dãy ~a_{i_{1}}, \dots, a_{i_{k}}~ thỏa mãn ~i_{1} < i_{2} < \dots < i_{k}~ và ~a_{i_{1}} < a_{i_{2}} < \dots < a_{i_{k}}~. Hãy cho biết dãy con tăng đơn điệu dài nhất của dãy này có bao nhiêu phần tử?
Input Specification
- Dòng thứ nhất gồm ~1~ số nguyên là số ~n~ ~(1 \le n \le 1000)~.
- Dòng thứ hai ghi ~n~ số nguyên ~a_1, a_2, \dots, a_n~ ~(1 \le a_i \le 10000)~.
Output Specification
- Ghi ra độ dài của dãy con tăng đơn điệu dài nhất.
Sample Cases
Input #1:
6
1 2 5 4 6 2
Output #1:
4
Explanation #1:
- Dãy ~1~: ~a_1 = 1 < a_2 = 2 < a_3 = 5 < a_5 = 6~, độ dài dãy này là ~4~.
- Dãy ~2~: ~a_1 = 1 < a_2 = 2 < a_4 = 4 < a_5 = 6~, độ dài dãy này cũng là ~4~.
Download test và solution tại đây.
Bình luận
According to all known laws of aviation, there is no way a bee should be able to fly. Its wings are too small to get its fat little body off the ground. The bee, of course, flies anyway because bees don't care what humans think is impossible. Yellow, black. Yellow, black. Yellow, black. Yellow, black. Ooh, black and yellow! Let's shake it up a little. Barry! Breakfast is ready! Coming! Hang on a second. Hello? Barry? Adam? Can you believe this is happening? I can't. I'll pick you up. Looking sharp. Use the stairs, Your father paid good money for those. Sorry. I'm excited. Here's the graduate. We're very proud of you, son. A perfect report card, all B's. Very proud. Ma! I got a thing going here. You got lint on your fuzz. Ow! That's me! Wave to us! We'll be in row 118,000. Bye! Barry, I told you, stop flying in the house! Hey, Adam. Hey, Barry. Is that fuzz gel? A little. Special day, graduation. Never thought I'd make it. Three days grade school, three days high school. Those were awkward. Three days college. I'm glad I took a day and hitchhiked around The Hive. You did come back different. Hi, Barry. Artie, growing a mustache? Looks good. Hear about Frankie? Yeah. You going to the funeral? No, I'm not going. Everybody knows, sting someone, you die. Don't waste it on a squirrel. Such a hothead. I guess he could have just gotten out of the way. I love this incorporating an amusement park into our day. That's why we don't need vacations. Boy, quite a bit of pomp under the circumstances. Well, Adam, today we are men.
ok santafe