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

19359번 - Even Three is Odd 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB116634049.383%

문제

The boboness of a sequence of integers $(x_1, x_2, \dots, x_n)$ is $\prod\limits_{i = 3}^n w(\max\{x_{i - 2}, x_{i - 1}, x_i\})$. Here, 1ドル \leq x_i \leq n,ドル and the values $w(1), w(2), \dots, w(n)$ are given.

Bobo would like to know the sum of boboness of all sequences satisfying 1ドル \leq x_i \leq n$. As this sum can be very large, he is interested only in the answer modulo $(10^9+7)$.

입력

The input contains zero or more test cases, and is terminated by end-of-file. For each test case:

The first line contains an integer $n$ (3ドル \leq n \leq 2000$).

The second line contains $n$ integers $w(1), w(2), \dots, w(n)$ (1ドル \leq w(i) \leq 10^9$).

It is guaranteed that the sum of $n$ does not exceed 2000ドル$.

출력

For each test case, output an integer which denotes the sum taken modulo $(10^9+7)$.

제한

예제 입력 1

3
1 2 3
4
1 1 1 1

예제 출력 1

72
256

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2017 > Day 2: Xiaoxu Guo Contest A번

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

출처

대학교 대회

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

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