結果
| 問題 | No.482 あなたの名は |
| コンテスト | |
| ユーザー |
kohaku_kohaku
|
| 提出日時 | 2017-02-10 23:18:24 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 723 bytes |
| 記録 | |
| コンパイル時間 | 2,458 ms |
| コンパイル使用メモリ | 75,112 KB |
| 実行使用メモリ | 65,928 KB |
| 最終ジャッジ日時 | 2024-12-29 04:37:07 |
| 合計ジャッジ時間 | 18,357 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 11 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
long K = sc.nextLong();
int [] D = new int [N+1];
for(int i=1; i<=N; i++){
D[i] = sc.nextInt();
}
int c=0;
for(int i=1; i<=N; i++){
if(i!=D[i]){
int tmp = D[i];
D[i] = D[tmp];
D[tmp] = tmp;
c++;
}
}
boolean b = true;
if(c>K)b = false;
if((K-c)%2==1)b=false;
if(b){
System.out.println("YES");
}else{
System.out.println("NO");
}
}
}
kohaku_kohaku