結果

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

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vi = vector<int>;
using vc = vector<char>;
using vs = vector<string>;
using vll = vector<ll>;

#define int long long
#define f first
#define s second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define foo(i, a, b) for (int i = (a); i < (b); ++i)
#define rfoo(i, a, b) for (int i = (a); i >= (b); --i)
#define input(v)      \
    for (auto &x : v) \
    cin >> x
#define print(v)          \
    for (auto x : v)      \
        cout << x << " "; \
    cout << '\n'
#define yes cout << "YES" << std::endl;
#define no cout << "NO" << std::endl;
#define nl cout << "\n";

const int MOD = 1e9 + 7;
const ll INF = 1e18;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll power(ll a, ll b)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res *= a;
        a *= a;
        b >>= 1;
    }
    return res;
}

ll modexp(ll a, ll b, ll mod = MOD)
{
    ll res = 1;
    a %= mod;
    while (b)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}

ll modmul(ll a, ll b, ll mod = MOD)
{
    return ((a % mod) * (b % mod)) % mod;
}

bool isprime(int n)
{
    if (n < 2)
        return false;
    for (int i = 2; i * i <= n; ++i)
        if (n % i == 0)
            return false;
    return true;
}

void sieve(int n, vector<bool> &isPrime)
{
    isPrime.assign(n + 1, true);
    isPrime[0] = isPrime[1] = false;
    for (int i = 2; i * i <= n; ++i)
        if (isPrime[i])
            for (int j = i * i; j <= n; j += i)
                isPrime[j] = false;
}

int getbit(ll n, int b) { return (n >> b) & 1; }
ll setbit(ll n, int b) { return n | (1LL << b); }
ll resetbit(ll n, int b) { return n & ~(1LL << b); }
ll togglebit(ll n, int b) { return n ^ (1LL << b); }
bool ispoftwo(ll n) { return n > 0 && !(n & (n - 1)); }
int countSetBits(ll n) { return __builtin_popcountll(n); }

int digitCount(ll n, int base = 10)
{
    return n ? (int)(log(n) / log(base)) + 1 : 1;
}

vi factors(int n)
{
    vi res;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            res.pb(i);
            if (i != n / i)
                res.pb(n / i);
        }
    }
    sort(all(res));
    return res;
}

#define lb(v, x) (lower_bound(all(v), x) - (v).begin())
#define ub(v, x) (upper_bound(all(v), x) - (v).begin())
#define count_occ(v, x) (ub(v, x) - lb(v, x))

#define fastio                   \
    ios::sync_with_stdio(false); \
    cin.tie(nullptr);            \
    cout.tie(nullptr)

signed main()
{
    fastio;

    int t = 1;
    // cin >> t;
    while (t--)
    {
        int n; cin>>n;
        vi v(n); input(v);
        int s = v[0]+v[n-1];
        bool  found=false;
        foo(i,0,n) {
            if (v[i]+ v[n-i-1] != s) {
                found = true;
                break;
            }
        }
        if(found) {
            cout<<"No";
        }
        else cout<<"Yes";
        nl
    }
}
0