結果

問題 No.1219 Mancala Combo
ユーザー w2w2
提出日時 2020-09-04 22:08:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,247 bytes
コンパイル時間 1,795 ms
コンパイル使用メモリ 196,876 KB
最終ジャッジ日時 2025-01-14 05:48:05
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
constexpr ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(12);
    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i,N)cin >> A[i];
    A[0] = 0;
    bool ok = 1;
    ll NA = N;
    RREP(i,NA){
        if(A[i] == 0){
            A.erase(A.begin() + i);
            N--;
        }else{
            break;
        }
    }
    REP(i,N){
        if(i != N-1){
            if(A[i] != i)ok = 0;
        }else{
            if(A[i] != N)ok = 0;
        }
    }
    if(N == 1)ok = 1;
    cout << (ok ? "Yes" : "No") << "\n";
}
0