結果
| 問題 | No.1242 高橋君とすごろく |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-11-20 11:49:42 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 845 bytes |
| 記録 | |
| コンパイル時間 | 3,650 ms |
| コンパイル使用メモリ | 75,916 KB |
| 実行使用メモリ | 239,544 KB |
| 最終ジャッジ日時 | 2024-07-23 12:01:44 |
| 合計ジャッジ時間 | 7,880 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 6 TLE * 1 -- * 17 |
ソースコード
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");
}
}
tenten