結果

問題 No.1538 引きこもりさんは引き算が得意。
ユーザー とりゐとりゐ
提出日時 2021-05-25 12:34:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 82,292 KB
実行使用メモリ 86,528 KB
最終ジャッジ日時 2024-05-02 11:59:11
合計ジャッジ時間 4,868 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,712 KB
testcase_01 AC 40 ms
51,712 KB
testcase_02 AC 40 ms
51,712 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 40 ms
52,352 KB
testcase_09 AC 40 ms
52,352 KB
testcase_10 AC 40 ms
51,968 KB
testcase_11 AC 41 ms
51,968 KB
testcase_12 AC 41 ms
52,480 KB
testcase_13 AC 40 ms
52,480 KB
testcase_14 AC 46 ms
60,032 KB
testcase_15 WA -
testcase_16 AC 42 ms
51,968 KB
testcase_17 AC 40 ms
51,840 KB
testcase_18 AC 40 ms
52,224 KB
testcase_19 AC 40 ms
51,956 KB
testcase_20 AC 40 ms
52,224 KB
testcase_21 AC 41 ms
52,352 KB
testcase_22 AC 41 ms
51,712 KB
testcase_23 AC 41 ms
52,096 KB
testcase_24 AC 40 ms
52,352 KB
testcase_25 AC 41 ms
52,464 KB
testcase_26 AC 40 ms
52,352 KB
testcase_27 AC 41 ms
52,480 KB
testcase_28 AC 41 ms
52,224 KB
testcase_29 AC 41 ms
52,352 KB
testcase_30 AC 41 ms
51,968 KB
testcase_31 AC 41 ms
52,224 KB
testcase_32 AC 41 ms
52,352 KB
testcase_33 AC 41 ms
51,840 KB
testcase_34 AC 41 ms
51,840 KB
testcase_35 AC 41 ms
51,712 KB
testcase_36 AC 41 ms
51,584 KB
testcase_37 AC 79 ms
75,604 KB
testcase_38 AC 93 ms
76,160 KB
testcase_39 AC 78 ms
75,872 KB
testcase_40 AC 76 ms
75,652 KB
testcase_41 AC 79 ms
75,584 KB
testcase_42 WA -
testcase_43 AC 40 ms
51,968 KB
testcase_44 AC 78 ms
75,576 KB
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 60 ms
72,448 KB
testcase_48 AC 96 ms
85,868 KB
testcase_49 AC 79 ms
76,072 KB
testcase_50 AC 40 ms
51,996 KB
testcase_51 AC 95 ms
85,952 KB
testcase_52 AC 99 ms
86,528 KB
testcase_53 AC 95 ms
86,000 KB
testcase_54 AC 95 ms
85,996 KB
testcase_55 AC 95 ms
86,436 KB
testcase_56 AC 96 ms
86,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#嘘解法
n,k=map(int,input().split())
a=list(map(int,input().split()))
if k in a:
  print('Yes')
  exit()
b=a[:(n//2)]
c=a[(n//2):]
nb=len(b)
nc=len(c)
s=set()
t=set()
import itertools
all=itertools.product([-1,0,1], repeat=nb)
for x in all:
  cnt=0
  for i in range(nb):
    cnt+=b[i]*x[i]
  s.add(cnt)

all=itertools.product([-1,0,1], repeat=nc)
for x in all:
  cnt=0
  for i in range(nc):
    cnt+=c[i]*x[i]
  t.add(cnt)

for i in s:
  if i+k in t:
    print('Yes')
    exit()
print('No')
0