結果
| 問題 |
No.480 合計
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-04-15 07:26:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 449 bytes |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 54,880 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 22:46:24 |
| 合計ジャッジ時間 | 3,535 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 22 |
ソースコード
#include<iostream>
using namespace std;
#define int long long
signed main(){
int N, K;
cin>> N>> K;
int a[N];
for(int i=0; i<N; i++){
cin>> a[i];
a[i]--;
}
int r=0;
for(int i=0; i<N; i++){
while(a[i]!=i){
swap(a[i], a[a[i]]);
r++;
}
}
if(r>K){
cout<< "NO"<< endl;
}else if((K-r)%2){
cout<< "NO"<< endl;
}else{
cout<< "YES"<< endl;
}
return 0;
}