結果

問題 No.868 ハイパー部分和問題
ユーザー vwxyzvwxyz
提出日時 2024-04-15 11:15:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,784 ms / 7,000 ms
コード長 547 bytes
コンパイル時間 823 ms
コンパイル使用メモリ 82,572 KB
実行使用メモリ 78,648 KB
最終ジャッジ日時 2024-04-15 11:16:35
合計ジャッジ時間 45,418 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
59,724 KB
testcase_01 AC 45 ms
58,664 KB
testcase_02 AC 46 ms
60,268 KB
testcase_03 AC 45 ms
58,840 KB
testcase_04 AC 40 ms
52,500 KB
testcase_05 AC 40 ms
53,752 KB
testcase_06 AC 40 ms
53,284 KB
testcase_07 AC 40 ms
52,212 KB
testcase_08 AC 40 ms
52,936 KB
testcase_09 AC 40 ms
52,212 KB
testcase_10 AC 40 ms
52,596 KB
testcase_11 AC 41 ms
53,536 KB
testcase_12 AC 41 ms
52,880 KB
testcase_13 AC 41 ms
53,984 KB
testcase_14 AC 2,117 ms
76,876 KB
testcase_15 AC 2,168 ms
77,192 KB
testcase_16 AC 2,117 ms
76,980 KB
testcase_17 AC 2,135 ms
76,928 KB
testcase_18 AC 2,149 ms
77,304 KB
testcase_19 AC 1,412 ms
76,824 KB
testcase_20 AC 1,441 ms
76,872 KB
testcase_21 AC 1,505 ms
76,944 KB
testcase_22 AC 1,414 ms
76,792 KB
testcase_23 AC 1,452 ms
77,396 KB
testcase_24 AC 1,413 ms
77,204 KB
testcase_25 AC 1,530 ms
77,064 KB
testcase_26 AC 1,415 ms
76,940 KB
testcase_27 AC 1,411 ms
77,028 KB
testcase_28 AC 1,413 ms
77,136 KB
testcase_29 AC 1,085 ms
77,020 KB
testcase_30 AC 1,099 ms
77,120 KB
testcase_31 AC 1,096 ms
76,996 KB
testcase_32 AC 2,107 ms
77,120 KB
testcase_33 AC 2,084 ms
77,000 KB
testcase_34 AC 2,784 ms
78,648 KB
testcase_35 AC 2,749 ms
77,208 KB
testcase_36 AC 2,327 ms
77,148 KB
testcase_37 AC 2,327 ms
77,152 KB
testcase_38 AC 39 ms
52,304 KB
testcase_39 AC 39 ms
53,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=list(map(int,input().split()))
mod=(1<<61)-1
P=[0]*(K+1)
P[0]=1
for a in A:
    if a:
        for k in range(K,a-1,-1):
            P[k]+=P[k-a]
            P[k]%=mod
Q=int(input())
for q in range(Q):
    x,v=map(int,input().split())
    x-=1
    if A[x]:
        for k in range(A[x],K+1):
            P[k]-=P[k-A[x]]
            P[k]%=mod
    A[x]=v
    if A[x]:
        for k in range(K,A[x]-1,-1):
            P[k]+=P[k-A[x]]
            P[k]%=mod
    if P[K]:
        ans=1
    else:
        ans=0
    print(ans)
0