結果

問題 No.1532 Different Products
ユーザー shakayamishakayami
提出日時 2021-06-04 22:22:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 649 bytes
コンパイル時間 1,243 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 599,652 KB
最終ジャッジ日時 2024-04-30 06:35:35
合計ジャッジ時間 20,027 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
57,344 KB
testcase_01 AC 852 ms
274,440 KB
testcase_02 AC 45 ms
62,976 KB
testcase_03 AC 37 ms
52,096 KB
testcase_04 AC 35 ms
51,968 KB
testcase_05 AC 34 ms
52,480 KB
testcase_06 AC 50 ms
64,512 KB
testcase_07 AC 52 ms
68,736 KB
testcase_08 AC 57 ms
75,264 KB
testcase_09 AC 244 ms
110,600 KB
testcase_10 AC 1,079 ms
279,076 KB
testcase_11 AC 748 ms
257,792 KB
testcase_12 AC 2,786 ms
442,060 KB
testcase_13 AC 1,250 ms
274,800 KB
testcase_14 TLE -
testcase_15 AC 71 ms
80,588 KB
testcase_16 AC 924 ms
279,624 KB
testcase_17 AC 726 ms
257,448 KB
testcase_18 AC 466 ms
172,148 KB
testcase_19 AC 2,548 ms
373,020 KB
testcase_20 TLE -
testcase_21 AC 1,399 ms
275,244 KB
testcase_22 AC 1,478 ms
279,624 KB
testcase_23 AC 652 ms
235,644 KB
testcase_24 TLE -
testcase_25 AC 2,311 ms
322,200 KB
testcase_26 AC 260 ms
115,784 KB
testcase_27 AC 1,970 ms
311,636 KB
testcase_28 AC 1,490 ms
279,212 KB
testcase_29 AC 1,375 ms
279,760 KB
testcase_30 AC 2,587 ms
373,544 KB
testcase_31 AC 2,584 ms
373,484 KB
testcase_32 AC 3,271 ms
465,592 KB
testcase_33 AC 2,350 ms
364,240 KB
testcase_34 MLE -
testcase_35 AC 3,092 ms
465,700 KB
testcase_36 MLE -
testcase_37 AC 809 ms
278,908 KB
testcase_38 TLE -
testcase_39 MLE -
testcase_40 MLE -
testcase_41 TLE -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
stack=[(N,K,0),(N,K,1)]
memo={}
ans=[]
while(stack):
    n,k,d=stack.pop()
    if d==1:
        if (n,k) in memo:
            ans.append(memo[(n,k)])
        elif k==0:
            memo[(n,k)]=0
            ans.append(0)
        elif n==0:
            memo[(n,k)]=1
            ans.append(1)
        else:
            stack.append((n-1,k,0))
            stack.append((n-1,k,1))
            stack.append((n-1,k//n,0))
            stack.append((n-1,k//n,1))
    else:
        if (n,k) in memo:
            pass
        else:
            ans.append(ans.pop()+ans.pop())
            memo[(n,k)]=ans[-1]
print(memo[(n,k)]-1)
0