Dãy con chung dài nhất (new ver)

View as PDF

Submit solution


Points: 0.18 (partial)
Time limit: 1.0s
Memory limit: 512M
Input: stdin
Output: stdout

Problem type
Allowed languages
C, C++, Go, Java, Kotlin, Pascal, PyPy, Python, Rust, Scratch

Cho ~m~ dãy là hoán vị của ~n~ số tự nhiên đầu tiên

Tìm độ dài dãy con chung dài nhất của ~m~ dãy đó

Input

Dòng đầu chứa số hai số nguyên ~n~ và ~m~ ~(1 \leq n \leq 1000~, ~1 \leq m \leq 10)~

~M~ dòng sau mỗi dòng chứa ~n~ số nguyên là dãya hoán vị của ~n~ số tự nhiên đầu tiên

Output

Đưa ra một dòng là độ dài lớn nhất của dãy con chung

Sample Input

5 3
1 5 3 4 2
1 3 4 2 5
3 1 5 4 2

Sample Output

3

Note

Dãy con chung dài nhất là ~1~, ~4~, ~2~


Comments

Please read the guidelines before commenting.



  • -10
    nguyenthihai14121980  commented on Aug. 16, 2024, 2:03 p.m.

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


  • -6
    Articulation_points  commented on March 12, 2024, 6:35 a.m.

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


  • -6
    buivietthanh  commented on May 3, 2023, 2:19 a.m. edited

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


    • -6
      minh22ti  commented on May 3, 2023, 3:02 a.m.

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