結果

問題 No.482 あなたの名は
ユーザー ldsyb
提出日時 2017-02-10 22:42:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 331 bytes
コンパイル時間 710 ms
コンパイル使用メモリ 64,320 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-28 08:00:03
合計ジャッジ時間 3,057 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
	long long n, k;
	cin >> n >> k;
	long long d[n];
	for(int i = 0; i < n; i++){
		cin >> d[i];
		d[i]--;
	}
	long long count = 0;
	for(int i = 0; i < n; i++) if(d[i] != i){
		count++;
		swap(d[i], d[d[i]]);
	}
	k -= count;
	cout << (k >= 0 && !(k & 1) ? "YES" : "NO") << endl;
}
0