Dãy con tăng dài nhất (bản dễ)

View as PDF

Submit solution


Points: 0.04
Time limit: 1.0s
Memory limit: 512M
Input: stdin
Output: stdout

Problem source:
Dân gian
Problem type
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch

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

  • Dòng ~1~ gồm ~1~ số nguyên là số ~N (1 \le N \le 1000)~.
  • Dòng thứ ~2~ ghi ~N~ số nguyên ~A_1, A_2, \dots, A_N (1 \le A_i \le 10000)~.

Output

Ghi ra độ dài của dãy con tăng đơn điệu dài nhất.

Sample Input

6
1 2 5 4 6 2

Sample Output

4

Note

Dãy con dài nhất là dãy ~A_1 = 1 < A_2 = 2 < A_4 = 4 < A_5 = 6~, độ dài dãy này là ~4~.

Download test và solution tại đây.


Comments

Please read the guidelines before commenting.



  • -6
    nb_truonghansieu_legiabao  commented on Aug. 1, 2024, 2:34 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • 0
    PhoDP  commented on June 16, 2024, 12:26 p.m.

    Quy Hoạch Động kiểu trước mắt ta mọi thứ đều hạ đẳng mình ta thưởng đẳng -Tôi kiểu A Long


  • -5
    Tuandunglopa1  commented on April 5, 2024, 8:24 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -19
    nb_lehongphong_tranngocminh  commented on Jan. 5, 2024, 10:24 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -15
    triclone_3  commented on Dec. 10, 2023, 10:55 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -13
    playerno1  commented on Dec. 3, 2023, 1:59 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -28
    asdsadsad  commented on Nov. 6, 2023, 4:12 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -26
    khoihk20  commented on Sept. 29, 2023, 2:52 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -44
    nthquan_1505  commented on March 30, 2023, 4:22 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -20
    Tri  commented on Feb. 19, 2023, 5:41 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -21
    MaiThanh1342  commented on Jan. 8, 2023, 8:39 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -29
    avatarstar1133  commented on July 29, 2022, 10:10 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -25
    Xcuad  commented on June 19, 2022, 2:47 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -26
    flexity  commented on May 26, 2022, 8:01 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


    • -16
      hh123123  commented on May 26, 2022, 12:34 p.m.

      This comment is hidden due to too much negative feedback. Show it anyway.


  • -51
    HV_DuongPhucThienNhan_BL_2022  commented on Jan. 12, 2022, 2:52 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -120
    manhtuan22007  commented on July 18, 2021, 8:01 a.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


  • -176
    dungp24  commented on May 29, 2021, 4:13 a.m. edited

    This comment is hidden due to too much negative feedback. Show it anyway.