結果

問題 No.482 あなたの名は
ユーザー aaaaaaiu
提出日時 2019-08-17 18:22:08
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 2,133 ms
コンパイル使用メモリ 193,132 KB
最終ジャッジ日時 2025-01-07 13:33:26
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ll n,k;
    cin>>n>>k;
    int a[n];
    for (int i=0;i<n;i++) {
        cin>>a[i];
        a[i]--;
    }
    for (int i=0;i<n;i++) {
        while (a[i]!=i) {
            swap(a[i],a[a[i]]);
            k--;
        }
    }
    if (k>=0&&k%2==0) puts("YES");
    else puts("NO");
    return 0;
}
0