結果

問題 No.3387 23578 Sequence
コンテスト
ユーザー vjudge1
提出日時 2026-02-09 02:11:24
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 670 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,255 ms
コンパイル使用メモリ 204,096 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-02-09 02:11:28
合計ジャッジ時間 3,512 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
#define LL long long int
int main () {
    int n;
    cin >> n;
    vector<int>a(n);
    for (int i=0; i<n; i++) {
        cin >> a[i];
    }
    if (n==1 || n==2) cout << "Yes\n";
    else {
        int ans = a[0]+a[n-1];
        int flag=0;
        for (int i=1; i<n/2; i++) {
            if (ans!=a[i]+a[n-1-i]) {
                flag=1;
                break;
            }
        }
        if (flag==1) cout << "No\n";
        else if (n%2 == 1) {
            int var = a[(n+1)/2]+a[(n+1)/2];
            if (var != ans) cout << "Yes\n";
            else cout << "No\n";
        }
        else cout << "Yes\n";
    }
}
0