結果

問題 No.2155 みちらcolor
ユーザー tentententen
提出日時 2022-12-26 09:16:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 1,803 bytes
コンパイル時間 2,887 ms
コンパイル使用メモリ 88,436 KB
実行使用メモリ 55,036 KB
最終ジャッジ日時 2024-04-30 19:42:11
合計ジャッジ時間 9,073 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
54,188 KB
testcase_01 AC 93 ms
54,396 KB
testcase_02 AC 83 ms
51,648 KB
testcase_03 AC 90 ms
51,924 KB
testcase_04 AC 91 ms
51,908 KB
testcase_05 AC 92 ms
54,188 KB
testcase_06 AC 78 ms
51,556 KB
testcase_07 AC 58 ms
50,272 KB
testcase_08 AC 91 ms
54,232 KB
testcase_09 AC 96 ms
54,172 KB
testcase_10 AC 83 ms
51,716 KB
testcase_11 AC 85 ms
51,812 KB
testcase_12 AC 93 ms
54,144 KB
testcase_13 AC 48 ms
50,372 KB
testcase_14 AC 95 ms
54,088 KB
testcase_15 AC 48 ms
50,160 KB
testcase_16 AC 84 ms
51,956 KB
testcase_17 AC 52 ms
50,544 KB
testcase_18 AC 95 ms
54,144 KB
testcase_19 AC 91 ms
54,292 KB
testcase_20 AC 99 ms
54,400 KB
testcase_21 AC 104 ms
54,280 KB
testcase_22 AC 93 ms
54,204 KB
testcase_23 AC 94 ms
54,208 KB
testcase_24 AC 107 ms
54,832 KB
testcase_25 AC 102 ms
54,436 KB
testcase_26 AC 102 ms
53,948 KB
testcase_27 AC 103 ms
54,464 KB
testcase_28 AC 100 ms
54,036 KB
testcase_29 AC 92 ms
54,228 KB
testcase_30 AC 109 ms
54,372 KB
testcase_31 AC 99 ms
54,756 KB
testcase_32 AC 97 ms
54,628 KB
testcase_33 AC 113 ms
54,484 KB
testcase_34 AC 104 ms
54,288 KB
testcase_35 AC 99 ms
54,540 KB
testcase_36 AC 103 ms
54,428 KB
testcase_37 AC 104 ms
54,372 KB
testcase_38 AC 99 ms
54,124 KB
testcase_39 AC 111 ms
54,580 KB
testcase_40 AC 104 ms
54,312 KB
testcase_41 AC 106 ms
55,036 KB
testcase_42 AC 50 ms
50,304 KB
testcase_43 AC 46 ms
50,148 KB
testcase_44 AC 47 ms
50,400 KB
testcase_45 AC 47 ms
50,440 KB
testcase_46 AC 47 ms
50,276 KB
testcase_47 AC 54 ms
50,660 KB
testcase_48 AC 51 ms
50,276 KB
testcase_49 AC 46 ms
50,444 KB
testcase_50 AC 52 ms
50,672 KB
testcase_51 AC 51 ms
50,164 KB
testcase_52 AC 49 ms
50,312 KB
testcase_53 AC 50 ms
50,432 KB
testcase_54 AC 50 ms
50,280 KB
testcase_55 AC 46 ms
50,400 KB
testcase_56 AC 51 ms
50,376 KB
testcase_57 AC 49 ms
50,416 KB
testcase_58 AC 48 ms
50,520 KB
testcase_59 AC 46 ms
50,348 KB
testcase_60 AC 47 ms
50,424 KB
testcase_61 AC 49 ms
50,276 KB
testcase_62 AC 51 ms
50,488 KB
testcase_63 AC 49 ms
50,552 KB
testcase_64 AC 48 ms
50,484 KB
testcase_65 AC 46 ms
50,372 KB
testcase_66 AC 49 ms
50,488 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++) {
            HashSet<Integer> next = new HashSet<>();
            int x = sc.nextInt();
            for (int y : current) {
                next.add((x + y) / 2);
            }
            current.addAll(next);
        }
        if (current.contains(m)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
class Utilities {
    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