結果

問題 No.1242 高橋君とすごろく
ユーザー CuriousFairy315CuriousFairy315
提出日時 2020-10-02 21:42:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 727 bytes
コンパイル時間 3,314 ms
コンパイル使用メモリ 74,968 KB
実行使用メモリ 56,532 KB
最終ジャッジ日時 2023-09-27 08:36:49
合計ジャッジ時間 7,855 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
55,708 KB
testcase_01 AC 110 ms
55,548 KB
testcase_02 AC 110 ms
55,792 KB
testcase_03 AC 113 ms
55,452 KB
testcase_04 AC 110 ms
55,904 KB
testcase_05 AC 108 ms
55,540 KB
testcase_06 AC 108 ms
55,524 KB
testcase_07 AC 110 ms
55,864 KB
testcase_08 AC 111 ms
55,328 KB
testcase_09 AC 111 ms
55,312 KB
testcase_10 AC 125 ms
56,216 KB
testcase_11 AC 121 ms
55,644 KB
testcase_12 AC 125 ms
55,580 KB
testcase_13 AC 128 ms
55,576 KB
testcase_14 AC 125 ms
55,548 KB
testcase_15 AC 131 ms
55,616 KB
testcase_16 AC 128 ms
56,532 KB
testcase_17 AC 126 ms
55,732 KB
testcase_18 AC 126 ms
55,608 KB
testcase_19 AC 128 ms
55,804 KB
testcase_20 AC 126 ms
55,608 KB
testcase_21 AC 127 ms
55,844 KB
testcase_22 AC 127 ms
56,504 KB
testcase_23 AC 126 ms
55,408 KB
testcase_24 AC 126 ms
55,728 KB
testcase_25 AC 122 ms
55,792 KB
testcase_26 AC 121 ms
55,476 KB
testcase_27 AC 106 ms
55,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import static java.lang.System.*;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(in)) {
			long N = sc.nextLong();
			int K = sc.nextInt();
			long[] A = new long[K];
			for (int i = 0;i < K;++ i) A[i] = sc.nextLong();
			HashSet<Long> set = new HashSet<>();
			for (long i : A) set.add(i);
			boolean No = false;
			boolean[] test = new boolean[30];
			for (int i = 20;i >= 0;-- i) {
				test[i] = set.contains((long)i);
				for (int j = 1;j <= 3;++ j) test[i] |= test[i + j] & test[i + 7 - j];
			}
			No |= test[1];
			for (long i : A) if (i > 20) for (int j = 0;j < 3;++ j) No |= set.contains(i + 2 * j + 1);
			out.println(No ? "No" : "Yes");
		}
	}

}
0