問題一覧 > 通常問題

No.3387 23578 Sequence

レベル : / AI推定難易度 : 101 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 125
作問者 : yu23578 / テスター : GaLLium yt142857 aa36 Germanium32
お気に入りにしたユーザー ProblemId : 12764 / 自分の提出
問題文最終更新日: 2025-11-28 10:18:10
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 490 (順位表) の他の問題:

Definition of a 23578 Sequence (this definition is the same as in Problem F)

A sequence $A$ of positive integers of length $N$ is called a "23578 sequence" if it satisfies $$A_i + A_{N-i+1} = A_1 + A_N$$ for all integers $i\ (1 \le i \le N)$. In that case, we call $A$ a "23578 sequence".

Problem Statement

You are given a sequence $A$ of positive integers of length $N$. Determine whether $A$ is a "23578 sequence".

Constraints

  • $1 \le N \le 100$
  • $1 \le A_i \le 100$
  • All input values are integers.

Input

$N$
$A_1\ A_2\ A_3\ \cdots\ A_N$

Output

Print Yes if $A$ is a "23578 sequence", and No otherwise.
Print a newline at the end.

Sample

Sample 1
Input
5
2 3 5 7 8
Output
Yes

The sequence $A = (2,3,5,7,8)$ satisfies

$A_1 + A_5 = 10 = A_1 + A_5 = 10$
$A_2 + A_4 = 10 = A_1 + A_5 = 10$
$A_3 + A_3 = 10 = A_1 + A_5 = 10$
$A_4 + A_2 = 10 = A_1 + A_5 = 10$
$A_5 + A_1 = 10 = A_1 + A_5 = 10$

so it is a 23578 sequence.

Sample 2
Input
4
2 3 5 7
Output
No

For the sequence $A = (2,3,5,7)$, we have

$A_1 + A_4 = 9 = A_1 + A_4 = 9$
$A_2 + A_3 = 8 \neq A_1 + A_4 = 9$
$A_3 + A_2 = 8 \neq A_1 + A_4 = 9$
$A_4 + A_1 = 9 = A_1 + A_4 = 9$

so it is not a 23578 sequence.

Sample 3
Input
1
100
Output
Yes

The sequence $A = (100)$ satisfies

$A_1 + A_1 = 200 = A_1 + A_1 = 200$

so it is a 23578 sequence.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。