|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||41||13||13||56.522%|
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 3 3 1 2
Case #1: 8