結果

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

ソースコード

diff #
raw source code

//Bismillah
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define nl cout<<"\n";
#define YN(condition) cout<<(condition?"YES":"NO")
#define yn(condition) cout<<(condition?"Yes":"No")

#define int long long
#define lint __int128
#define ll long long
#define ld long double
#define pii pair<int,int>
const int inf = 1e17;
const int MOD = 1000000007;

#define ac(n) array<char,n>
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define vpi vector<pair<int,int>>
#define vvi vector<vector<int>>
#define mp map<int,int>
#define pq priority_queue<int>
#define pqmin priority_queue<int, vector<int>, greater<int>>
#define pqminpair priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>

#define f(i,s,e) for(int i=s;i<e;i++)
#define fn(i,s,e) for(int i=s;i>=e;i--)
#define printv(vec) for(auto &value: vec) cout<<value<<" ";
#define inputv(vec) for(auto &value: vec) cin>>value;

#define pb push_back
#define pp pop_back
#define all(s) s.begin(), s.end()
#define sa(vec) sort(vec.begin(), vec.end())
#define sd(vec) sort(vec.begin(), vec.end(), [](int a, int b){return a>b;})

template <typename T>
using ordered_set = tree<
    T,           // key type
    null_type,   // mapped type (null => set)
    less<T>,     // ordering
    rb_tree_tag, // red-black tree
    tree_order_statistics_node_update>;
// .find_by_order(k) returns iterator of kth smallest element (0 based)
// .order_of_key(k) returns number of elements < x

template <typename A, typename B>
istream& operator>>(istream &in, pair<A,B> &p) {
    in >> p.first >> p.second;
    return in;
}
template <typename T>
istream& operator>>(istream &in, vector<T> &v) {
    for (auto &x : v) in >> x;
    return in;
}
template <typename A, typename B>
istream& operator>>(istream &in, vector<pair<A,B>> &vp) {
    for (auto &p : vp) in >> p.first >> p.second;
    return in;
}
template <typename A, typename B>
ostream& operator<<(ostream &out, const pair<A,B> &p) {
    out << p.first << " " << p.second;
    return out;
}
template <typename T>
ostream& operator<<(ostream &out, const vector<T> &v) {
    for (auto &x : v) out << x << " ";
    return out;
}
template <typename A, typename B>
ostream& operator<<(ostream &out, const vector<pair<A,B>> &vp) {
    for (auto &p : vp) out << p.first << " " << p.second << "\n";
    return out;
}

#define fastnuces ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);int t = 1;
int test=0;
void solve(){
    int n;
    cin>>n;
    vi arr(n);
    cin>>arr;
    int sum = arr[0] + arr[n-1];
    f(i, 0, n){
        if(arr[i] + arr[n-1-i]!=sum){
            cout<<"No";
            return;
        }
    }
    cout<<"Yes";
}
signed main() {
    fastnuces;
    // cin >> t;
    while (t--) {
        test++;
        solve();
        nl
    }
    return 0;
}
0