結果

問題 No.482 あなたの名は
ユーザー shinwisteriashinwisteria
提出日時 2017-03-20 20:51:45
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 666 bytes
コンパイル時間 4,880 ms
コンパイル使用メモリ 73,624 KB
実行使用メモリ 57,024 KB
最終ジャッジ日時 2023-09-18 13:21:27
合計ジャッジ時間 12,903 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,884 KB
testcase_01 AC 123 ms
55,824 KB
testcase_02 AC 124 ms
55,796 KB
testcase_03 AC 122 ms
56,076 KB
testcase_04 AC 124 ms
56,096 KB
testcase_05 AC 121 ms
55,824 KB
testcase_06 AC 116 ms
55,832 KB
testcase_07 AC 192 ms
56,676 KB
testcase_08 AC 184 ms
56,396 KB
testcase_09 AC 139 ms
55,648 KB
testcase_10 AC 173 ms
56,144 KB
testcase_11 AC 193 ms
56,556 KB
testcase_12 AC 200 ms
56,768 KB
testcase_13 AC 173 ms
56,084 KB
testcase_14 AC 181 ms
57,024 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 {
	static ArrayList<Integer> list = new ArrayList<>();
	static long K;
	static int N;

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

}
0