F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Palindrome Bo

Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 532    Accepted Submission(s): 201


Problem Description
There is an array with $n$ elements named $a$.If $seq$ is a palindrome subsequence of $a$,whose elements are increasing from the middle to both ends,then we call it a BoBo sequence.

Two BoBo sequence are considered different if and only if they have different length or there is at least one position has a different number.

Your task is to calculate how many different longest BoBo sequence are there in $a$.
 

Input
There are several test cases.

The first line contains an integer $n$.

The second contains $n$ numbers indicating $a_i$.

$1\leq n\leq 5000,1\leq a_i\leq 20000$
 

Output
One line two number indicating the length of the longest BoBo sequence and the quantity of them.

answer mod 10^9+7
 

Sample Input
5 1 1 1 1 1 5 2 2 3 2 2
 

Sample Output
5 1 4 1
 

Author
ÉÜÐËÒ»ÖÐ
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-24 23:45:55, Gzip enabled