結果

問題 No.2155 みちらcolor
ユーザー tentententen
提出日時 2023-03-03 08:38:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 1,955 bytes
コンパイル時間 6,985 ms
コンパイル使用メモリ 84,184 KB
実行使用メモリ 58,240 KB
最終ジャッジ日時 2023-10-18 00:49:22
合計ジャッジ時間 13,247 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
57,704 KB
testcase_01 AC 92 ms
57,620 KB
testcase_02 AC 94 ms
55,308 KB
testcase_03 AC 98 ms
55,144 KB
testcase_04 AC 96 ms
55,320 KB
testcase_05 AC 97 ms
57,336 KB
testcase_06 AC 87 ms
54,396 KB
testcase_07 AC 79 ms
54,132 KB
testcase_08 AC 91 ms
57,404 KB
testcase_09 AC 104 ms
57,496 KB
testcase_10 AC 90 ms
54,832 KB
testcase_11 AC 93 ms
55,092 KB
testcase_12 AC 100 ms
57,276 KB
testcase_13 AC 55 ms
53,544 KB
testcase_14 AC 106 ms
57,536 KB
testcase_15 AC 56 ms
53,568 KB
testcase_16 AC 91 ms
54,388 KB
testcase_17 AC 59 ms
53,568 KB
testcase_18 AC 92 ms
57,360 KB
testcase_19 AC 94 ms
57,728 KB
testcase_20 AC 118 ms
57,776 KB
testcase_21 AC 110 ms
57,856 KB
testcase_22 AC 106 ms
57,528 KB
testcase_23 AC 95 ms
57,560 KB
testcase_24 AC 118 ms
57,684 KB
testcase_25 AC 118 ms
57,692 KB
testcase_26 AC 115 ms
57,660 KB
testcase_27 AC 123 ms
58,240 KB
testcase_28 AC 111 ms
57,616 KB
testcase_29 AC 111 ms
57,556 KB
testcase_30 AC 114 ms
57,708 KB
testcase_31 AC 115 ms
58,072 KB
testcase_32 AC 116 ms
57,972 KB
testcase_33 AC 117 ms
57,704 KB
testcase_34 AC 114 ms
57,536 KB
testcase_35 AC 111 ms
57,688 KB
testcase_36 AC 115 ms
57,724 KB
testcase_37 AC 118 ms
57,776 KB
testcase_38 AC 114 ms
57,648 KB
testcase_39 AC 117 ms
57,632 KB
testcase_40 AC 118 ms
57,488 KB
testcase_41 AC 118 ms
57,780 KB
testcase_42 AC 58 ms
53,576 KB
testcase_43 AC 55 ms
53,556 KB
testcase_44 AC 55 ms
53,556 KB
testcase_45 AC 54 ms
53,544 KB
testcase_46 AC 53 ms
53,552 KB
testcase_47 AC 65 ms
54,128 KB
testcase_48 AC 61 ms
53,564 KB
testcase_49 AC 53 ms
53,552 KB
testcase_50 AC 59 ms
53,564 KB
testcase_51 AC 59 ms
53,572 KB
testcase_52 AC 58 ms
53,564 KB
testcase_53 AC 59 ms
53,564 KB
testcase_54 AC 59 ms
53,564 KB
testcase_55 AC 54 ms
53,544 KB
testcase_56 AC 61 ms
53,564 KB
testcase_57 AC 57 ms
53,556 KB
testcase_58 AC 56 ms
53,564 KB
testcase_59 AC 55 ms
53,548 KB
testcase_60 AC 55 ms
52,524 KB
testcase_61 AC 56 ms
53,556 KB
testcase_62 AC 60 ms
53,568 KB
testcase_63 AC 56 ms
53,560 KB
testcase_64 AC 56 ms
53,568 KB
testcase_65 AC 54 ms
53,552 KB
testcase_66 AC 56 ms
53,572 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 m = sc.nextInt();
        HashSet<Integer> current = new HashSet<>();
        current.add(sc.nextInt());
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            HashSet<Integer> tmp = new HashSet<>();
            for (int y : current) {
                tmp.add((x + y) / 2);
            }
            current.addAll(tmp);
        }
        if (current.contains(m)) {
            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