結果

問題 No.2155 みちらcolor
ユーザー tentententen
提出日時 2023-04-21 08:29:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 1,979 bytes
コンパイル時間 2,383 ms
コンパイル使用メモリ 85,320 KB
実行使用メモリ 42,284 KB
最終ジャッジ日時 2024-04-23 23:23:37
合計ジャッジ時間 7,491 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
37,156 KB
testcase_01 AC 90 ms
40,900 KB
testcase_02 AC 46 ms
37,436 KB
testcase_03 AC 48 ms
37,276 KB
testcase_04 AC 88 ms
40,408 KB
testcase_05 AC 53 ms
37,516 KB
testcase_06 AC 49 ms
37,512 KB
testcase_07 AC 47 ms
37,352 KB
testcase_08 AC 94 ms
40,992 KB
testcase_09 AC 46 ms
37,336 KB
testcase_10 AC 50 ms
37,476 KB
testcase_11 AC 45 ms
37,316 KB
testcase_12 AC 55 ms
37,656 KB
testcase_13 AC 45 ms
37,284 KB
testcase_14 AC 46 ms
37,236 KB
testcase_15 AC 46 ms
37,316 KB
testcase_16 AC 47 ms
37,408 KB
testcase_17 AC 47 ms
37,172 KB
testcase_18 AC 95 ms
40,764 KB
testcase_19 AC 48 ms
37,140 KB
testcase_20 AC 47 ms
37,412 KB
testcase_21 AC 50 ms
37,436 KB
testcase_22 AC 49 ms
37,076 KB
testcase_23 AC 82 ms
39,868 KB
testcase_24 AC 84 ms
39,588 KB
testcase_25 AC 47 ms
36,884 KB
testcase_26 AC 50 ms
37,480 KB
testcase_27 AC 49 ms
37,060 KB
testcase_28 AC 49 ms
37,252 KB
testcase_29 AC 47 ms
37,272 KB
testcase_30 AC 49 ms
37,148 KB
testcase_31 AC 46 ms
37,052 KB
testcase_32 AC 46 ms
37,396 KB
testcase_33 AC 47 ms
37,316 KB
testcase_34 AC 105 ms
42,284 KB
testcase_35 AC 60 ms
37,852 KB
testcase_36 AC 50 ms
37,352 KB
testcase_37 AC 50 ms
37,280 KB
testcase_38 AC 98 ms
41,880 KB
testcase_39 AC 52 ms
37,212 KB
testcase_40 AC 48 ms
37,304 KB
testcase_41 AC 88 ms
40,608 KB
testcase_42 AC 50 ms
37,496 KB
testcase_43 AC 47 ms
37,252 KB
testcase_44 AC 46 ms
37,308 KB
testcase_45 AC 45 ms
37,300 KB
testcase_46 AC 46 ms
37,436 KB
testcase_47 AC 48 ms
37,320 KB
testcase_48 AC 47 ms
37,336 KB
testcase_49 AC 46 ms
36,800 KB
testcase_50 AC 48 ms
37,040 KB
testcase_51 AC 50 ms
37,572 KB
testcase_52 AC 45 ms
37,272 KB
testcase_53 AC 50 ms
37,564 KB
testcase_54 AC 45 ms
37,316 KB
testcase_55 AC 46 ms
37,148 KB
testcase_56 AC 46 ms
37,396 KB
testcase_57 AC 46 ms
37,320 KB
testcase_58 AC 47 ms
37,304 KB
testcase_59 AC 45 ms
37,220 KB
testcase_60 AC 45 ms
36,916 KB
testcase_61 AC 45 ms
37,272 KB
testcase_62 AC 51 ms
37,316 KB
testcase_63 AC 47 ms
37,148 KB
testcase_64 AC 47 ms
37,336 KB
testcase_65 AC 45 ms
37,048 KB
testcase_66 AC 46 ms
37,412 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int target = sc.nextInt();
        HashSet<Integer> base = new HashSet<>();
        base.add(sc.nextInt());
        for (int i = 0; i < n && !base.contains(target); i++) {
            HashSet<Integer> next = new HashSet<>();
            int y = sc.nextInt();
            for (int x : base) {
                next.add((x + y) / 2);
            }
            base.addAll(next);
        }
        if (base.contains(target)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0