結果
| 問題 |
No.482 あなたの名は
|
| コンテスト | |
| ユーザー |
uafr_cs
|
| 提出日時 | 2017-02-10 22:34:35 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 850 bytes |
| コンパイル時間 | 2,457 ms |
| コンパイル使用メモリ | 76,132 KB |
| 実行使用メモリ | 66,368 KB |
| 最終ジャッジ日時 | 2024-12-28 07:21:10 |
| 合計ジャッジ時間 | 18,858 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 11 |
ソースコード
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final int N = sc.nextInt();
final long K = sc.nextLong();
int[] swap = new int[N];
for(int i = 0; i < N; i++){
swap[i] = sc.nextInt() - 1;
}
long min_times = 0;
for(int i = 0; i < N; i++){
if(swap[i] != i){
final int tmp = swap[swap[i]];
swap[swap[i]] = swap[i];
swap[i] = tmp;
min_times++;
}
//System.out.println(Arrays.toString(swap));
}
if(min_times > K || (K - min_times) % 2 != 0){
System.out.println("NO");
}else{
System.out.println("YES");
}
}
}
uafr_cs