結果

問題 No.482 あなたの名は
ユーザー shinwisteriashinwisteria
提出日時 2017-03-20 17:37:57
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 3,421 ms
コンパイル使用メモリ 72,372 KB
実行使用メモリ 73,740 KB
最終ジャッジ日時 2023-09-18 12:34:48
合計ジャッジ時間 10,878 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
56,132 KB
testcase_01 AC 127 ms
55,564 KB
testcase_02 AC 128 ms
55,848 KB
testcase_03 AC 130 ms
55,584 KB
testcase_04 AC 125 ms
55,764 KB
testcase_05 AC 126 ms
55,636 KB
testcase_06 AC 126 ms
55,408 KB
testcase_07 AC 202 ms
56,608 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 181 ms
56,460 KB
testcase_11 AC 194 ms
56,276 KB
testcase_12 AC 203 ms
56,152 KB
testcase_13 AC 180 ms
55,836 KB
testcase_14 AC 164 ms
55,728 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;

public class YourName {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		long K = s.nextLong();
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0;i<N;i++){
			list.add(s.nextInt());
		}
		s.close();
		for(int i = 1;i <= N;i++){
			if(i != list.get(i-1)){
				int t = list.indexOf(i);
				list.set(t, list.get(i-1));
				list.set(i-1, i);
				K--;
			}
		}
		if(K%2 == 0){
			K = 0;
		}
		if(K == 0)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}
0