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

9702번 - LIS 다국어

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

문제

Mr. C is interested with Longest Increasing Subsequence problem. Given a sequence S = s1, s2, …, sN. The Longest Increasing Subsequence is the subsequence L = l1, l2, …, lk of S such that l1 < l2 < … < lk.

Given a sequence S, find the total length of LIS of every consecutive subsequence (subsequence which elements are consecutive in the original sequence) of S with non zero length!

입력

The first line of input consists of an integer T denotes the number of cases. It is followed by T blocks, each representing a case.

The first line of each case contains an integers: N (1 ≤ N ≤ 500), the length of S.

The next N lines each consists of an integer si (1 ≤ si ≤ N) denoting the i-th element of S. Each element of S is unique.

출력

Output consists of T lines, each describes the solution for each case with the same order as in input.

Each case consists of a single line with the format “Case #i: S”, where i represents the case number and S represents the total length of LIS of every consecutive subsequence of S.

제한

예제 입력 1

1
3
3
1
2

예제 출력 1

Case #1: 8

힌트

출처

ICPC > Regionals > Asia Pacific > Malaysia > Malaysia National Programming Contest > Al-Khawarizmi National Programming Contest 2013 J번

  • 잘못된 데이터를 찾은 사람: dotorya
(追記) (追記ここまで)

출처

대학교 대회

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

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