結果

問題 No.482 あなたの名は
ユーザー shinwisteriashinwisteria
提出日時 2017-03-20 17:53:59
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 602 bytes
コンパイル時間 3,491 ms
コンパイル使用メモリ 73,304 KB
実行使用メモリ 57,048 KB
最終ジャッジ日時 2023-09-18 12:35:53
合計ジャッジ時間 11,393 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,772 KB
testcase_01 AC 130 ms
55,588 KB
testcase_02 AC 128 ms
55,896 KB
testcase_03 AC 126 ms
55,640 KB
testcase_04 AC 125 ms
55,996 KB
testcase_05 AC 125 ms
55,992 KB
testcase_06 AC 125 ms
55,784 KB
testcase_07 AC 201 ms
56,612 KB
testcase_08 AC 199 ms
57,048 KB
testcase_09 AC 146 ms
55,640 KB
testcase_10 AC 177 ms
55,928 KB
testcase_11 AC 199 ms
56,008 KB
testcase_12 AC 202 ms
56,840 KB
testcase_13 AC 179 ms
56,052 KB
testcase_14 AC 167 ms
56,256 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 > 0&&K%2 == 0){
			K = 0;
		}
		if(K == 0)
			System.out.println("YES");
		else
			System.out.println("NO");
	}

}
0