Logo
(追記) (追記ここまで)

8529번 - NumberEater 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB129512934.940%

문제

The NumberEater is a famous monster from Byteland. It eats numbers, but it is very picky: each day its meal must be unique. The monster is given a sequence of integers (an). It chooses the starting and ending positions of a meal -i and j (1 ≤ i ≤ j ≤ n) - and prepares a meal that consists of elements ai, ai+1, …, aj. The monster considers two meals [i1,j1] and [i2,j2] identical if the sets of numbers that they contain are the same; in other words:

{ak : i1 ≤ k ≤ j1} = {ak : i2 ≤ k ≤ j2}

Help NumberEater and count the number of different meals that it can prepare using only the sequence a.

입력

The first line of the input contains one integer n (1 ≤ n ≤ 500), the length of the sequence a. The following n lines contain values of elements of the sequence. Each of them is at least 1 and at most 500.

출력

The first and only line of the output should contain the number of different meals that NumberEater can prepare.

제한

예제 입력 1

6
1
2
3
1
2
3

예제 출력 1

7

힌트

출처

Camp > POI Training Camp > ONTAK 2007 10번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /