結果

問題 No.1861 Required Number
ユーザー mkawa2mkawa2
提出日時 2022-03-04 21:54:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,053 bytes
コンパイル時間 1,877 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 80,956 KB
最終ジャッジ日時 2023-09-26 03:28:21
合計ジャッジ時間 16,148 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,244 KB
testcase_01 AC 69 ms
71,204 KB
testcase_02 AC 70 ms
71,372 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 70 ms
71,132 KB
testcase_06 AC 72 ms
71,088 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 71 ms
71,436 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 71 ms
71,404 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 69 ms
71,256 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
04_evil_1.txt MLE -
04_evil_2.txt TLE -
04_evil_3.txt MLE -
04_evil_4.txt MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

n, k = LI()
aa = LI()

mask = (1 << k+1)-1
ll = [1]
for a in aa:
    ll.append(ll[-1] << a & mask | ll[-1])

if (ll[-1] & 1 << k) == 0:
    print(-1)
    exit()

rr = [1 << k]
for a in aa[::-1]:
    rr.append(rr[-1] >> a | rr[-1])

ans = n
for i in range(n):
    if ll[i] & rr[i+1]:
        # pDB(i)
        ans -= 1

print(ans)
0