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

20788번 - Arrange and Count! 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB459924.324%

문제

Alice has a sequence $a_1,a_2,\dots,a_n$. She can rearrange the sequence using the following operation any number of times:

  • Select an integer $i$ (1ドル \le i \le n$) and change the sequence to $a_i, a_{i-1}, \dots, a_1, a_n, a_{n-1}, \dots, a_{i+1}$.

Alice would like to know the number of different sequences can be obtained modulo $(10^9+7)$.

입력

The input consists of several test cases terminated by end-of-file. For each test case:

The first line contains an integer $n,ドル the length of the sequence.

The second line contains $n$ integers $a_1, a_2, \dots, a_n$.

출력

For each test case, print an integer which denotes the result.

제한

  • 1ドル \leq n \leq 10^5$
  • 1ドル \leq a_i \leq n$
  • The sum of $n$ does not exceed 2ドル \times 10^6$.

예제 입력 1

4
1 1 1 1
4
1 1 2 2
4
1 2 1 2
4
2 1 2 1

예제 출력 1

1
4
2
2

힌트

출처

Contest > Open Cup > 2020/2021 Season > Stage 6: Grand Prix of NorthBeach (Bei Sha Tan), Division 1 A번

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

출처

대학교 대회

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

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