結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー H3PO4
提出日時 2024-04-14 09:24:17
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 82,092 KB
実行使用メモリ 677,720 KB
最終ジャッジ日時 2024-10-03 06:25:57
合計ジャッジ時間 10,476 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 WA * 4 MLE * 1 -- * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(K, A):
    if K == sum(A) or K == -sum(A):
        return False
    st = set()
    for a in A:
        new_st = set()
        new_st.add(a)
        for x in st:
            new_st.add(x)
            new_st.add(a - x)
            new_st.add(x - a)
        st = new_st
        # print(st)
    return K in st


N, K = map(int, input().split())
A = list(map(int, input().split()))
print("Yes" if solve(K, A) else "No")
0