結果
| 問題 |
No.1538 引きこもりさんは引き算が得意。
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2024-02-08 03:05:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 675 bytes |
| コンパイル時間 | 347 ms |
| コンパイル使用メモリ | 82,076 KB |
| 実行使用メモリ | 574,356 KB |
| 最終ジャッジ日時 | 2024-09-28 12:42:05 |
| 合計ジャッジ時間 | 9,766 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 WA * 4 MLE * 1 -- * 9 |
ソースコード
def subs(a: list) -> set:
s = set()
for x in a:
t = s.copy()
for y in s:
t.add(x - y)
t.add(y - x)
t.add(x)
s = t
return s
N, K = map(int, input().split())
A = list(map(int, input().split()))
if K in A:
print('Yes')
exit()
def solve():
a = A[:N//2]
b = A[N//2:]
xs = subs(a)
ys = subs(b)
print(f'{a=} {xs=}')
print(f'{b=} {ys=}')
if K in xs or K in ys: return True
for x in xs:
if x-K in ys or x+K in ys:
return True
return False
def solve2():
xs = subs(A)
return K in xs
if solve2():
print('Yes')
else:
print('No')
norioc