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.



  • -12
    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.


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


  • -44
    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.


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

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


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

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