6707.Playlist

Time Limit: 1s Memory Limit: 512MB

You are given a playlist of a radio station since its establishment. The playlist has a total of $n$ songs.

What is the longest sequence of successive songs where each song is unique?

Input Format(From the terminal/stdin)

The first input line contains an integer $n$ : the number of songs.

The next line has $n$ integers $k_1,k_2,\ldots,k_n$ : the id number of each song.

  • $1 \le n \le 2 \cdot 10^5$
  • $1 \le k_i \le 10^9$

Output Format(To the terminal/stdout)

Print the length of the longest sequence of unique songs.

Sample Input

Copy
8
1 2 1 3 2 7 4 2
 \n
 · · · · · · · \n

Sample Output

Copy
5
 \n
Source: CSES, Sorting and Searching, 1141

Submit

请先 登录

© 2025 FAQs