結果

問題 No.1242 高橋君とすごろく
ユーザー tentententen
提出日時 2020-11-20 11:49:42
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 845 bytes
コンパイル時間 3,913 ms
コンパイル使用メモリ 73,020 KB
実行使用メモリ 237,900 KB
最終ジャッジ日時 2023-09-30 18:21:52
合計ジャッジ時間 8,484 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
60,340 KB
testcase_01 AC 128 ms
55,676 KB
testcase_02 AC 126 ms
55,548 KB
testcase_03 AC 126 ms
55,884 KB
testcase_04 AC 127 ms
55,860 KB
testcase_05 AC 131 ms
55,996 KB
testcase_06 AC 128 ms
55,532 KB
testcase_07 AC 128 ms
55,576 KB
testcase_08 AC 128 ms
55,984 KB
testcase_09 AC 127 ms
55,868 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		int k = sc.nextInt();
		TreeSet<Long> out = new TreeSet<>();
		for (int i = 0; i < k; i++) {
		    out.add(sc.nextLong());
		}
		Long current = Long.MAX_VALUE;
		while ((current = out.lower(current)) != null) {
		    long target = current - 4;
		    if (target > 0 && out.contains(target + 3)) {
		        out.add(target);
		    }
		    target = current - 5;
		    if (target > 0 && out.contains(target + 2)) {
		        out.add(target);
		    }
		    target = current - 6;
		    if (target > 0 && out.contains(target + 1)) {
		        out.add(target);
		    }
		    if (out.contains(1L)) {
		        System.out.println("No");
		        return;
		    }
		}
		System.out.println("Yes");
   }
}

0