結果

問題 No.482 あなたの名は
ユーザー hkrhkr
提出日時 2017-02-10 23:23:50
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 401 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 58,708 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-29 05:00:03
合計ジャッジ時間 2,709 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;

int main() {
    ll n, k;
    cin >> n >> k;
    vector<int> d(n+1);
    for(int i=1;i<=n;i++) cin >> d[i];
    int l = 1, r = n;
    int cnt = 0;
    for(int i=1;i<=n;i++)
        if(d[i] == i) cnt++;
    n -= cnt;n--;
    if(n%2==k%2 || n < 0)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
0