結果

問題 No.868 ハイパー部分和問題
ユーザー convexineqconvexineq
提出日時 2020-11-22 05:57:23
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 2,692 ms / 7,000 ms
コード長 428 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 87,052 KB
実行使用メモリ 79,636 KB
最終ジャッジ日時 2023-09-30 22:30:03
合計ジャッジ時間 39,976 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,820 KB
testcase_01 AC 77 ms
75,728 KB
testcase_02 AC 77 ms
75,944 KB
testcase_03 AC 77 ms
75,708 KB
testcase_04 AC 72 ms
71,568 KB
testcase_05 AC 73 ms
71,292 KB
testcase_06 AC 72 ms
71,240 KB
testcase_07 AC 73 ms
71,052 KB
testcase_08 AC 73 ms
71,108 KB
testcase_09 AC 72 ms
71,428 KB
testcase_10 AC 72 ms
71,104 KB
testcase_11 AC 73 ms
71,624 KB
testcase_12 AC 72 ms
71,364 KB
testcase_13 AC 72 ms
71,468 KB
testcase_14 AC 1,724 ms
79,516 KB
testcase_15 AC 1,713 ms
79,372 KB
testcase_16 AC 1,722 ms
79,508 KB
testcase_17 AC 1,708 ms
79,384 KB
testcase_18 AC 1,719 ms
79,416 KB
testcase_19 AC 1,255 ms
78,164 KB
testcase_20 AC 1,254 ms
77,932 KB
testcase_21 AC 1,264 ms
78,012 KB
testcase_22 AC 1,261 ms
77,892 KB
testcase_23 AC 1,259 ms
78,528 KB
testcase_24 AC 1,260 ms
77,964 KB
testcase_25 AC 1,266 ms
78,432 KB
testcase_26 AC 1,259 ms
78,012 KB
testcase_27 AC 1,263 ms
78,140 KB
testcase_28 AC 1,264 ms
78,116 KB
testcase_29 AC 938 ms
79,420 KB
testcase_30 AC 934 ms
79,548 KB
testcase_31 AC 940 ms
79,440 KB
testcase_32 AC 1,718 ms
79,112 KB
testcase_33 AC 1,719 ms
79,116 KB
testcase_34 AC 2,605 ms
78,532 KB
testcase_35 AC 2,692 ms
78,740 KB
testcase_36 AC 1,899 ms
79,636 KB
testcase_37 AC 1,895 ms
79,472 KB
testcase_38 AC 73 ms
71,400 KB
testcase_39 AC 71 ms
71,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def mul(c,m):
    for i in range(m,c-1,-1): dp[i] = (dp[i]+dp[i-c])%MOD
def div(c,m):
    for i in range(m-c+1): dp[i+c] = (dp[i+c]-dp[i])%MOD
n,k = map(int,input().split())
*a, = map(int,input().split())
MOD = 2**59+1
dp = [0]*(k+1)
dp[0] = 1
for i in a: mul(i,k)
q = int(input())
for _ in range(q):
    x,v = map(int,input().split())
    if a[x-1]: div(a[x-1],k)
    if v: mul(v,k)
    a[x-1] = v
    print(1 if dp[-1] else 0)
0