結果

問題 No.1531 く2
ユーザー googol_S0googol_S0
提出日時 2021-06-04 20:30:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 80,904 KB
最終ジャッジ日時 2023-08-12 09:36:23
合計ジャッジ時間 8,984 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
77,120 KB
testcase_01 AC 93 ms
76,996 KB
testcase_02 AC 95 ms
77,056 KB
testcase_03 AC 111 ms
80,712 KB
testcase_04 AC 102 ms
80,592 KB
testcase_05 AC 102 ms
80,560 KB
testcase_06 AC 92 ms
77,296 KB
testcase_07 AC 94 ms
77,020 KB
testcase_08 AC 87 ms
76,736 KB
testcase_09 AC 92 ms
77,028 KB
testcase_10 AC 99 ms
80,844 KB
testcase_11 AC 102 ms
80,392 KB
testcase_12 AC 106 ms
80,552 KB
testcase_13 AC 109 ms
80,624 KB
testcase_14 AC 111 ms
80,684 KB
testcase_15 AC 110 ms
80,536 KB
testcase_16 AC 111 ms
80,904 KB
testcase_17 AC 109 ms
80,740 KB
testcase_18 AC 108 ms
80,208 KB
testcase_19 AC 107 ms
80,688 KB
testcase_20 AC 114 ms
80,416 KB
testcase_21 AC 113 ms
80,824 KB
testcase_22 AC 113 ms
80,492 KB
testcase_23 AC 110 ms
80,660 KB
testcase_24 AC 112 ms
80,552 KB
testcase_25 AC 110 ms
80,456 KB
testcase_26 AC 111 ms
80,552 KB
testcase_27 AC 115 ms
80,556 KB
testcase_28 AC 112 ms
80,604 KB
testcase_29 AC 112 ms
80,312 KB
testcase_30 AC 113 ms
80,460 KB
testcase_31 AC 112 ms
80,640 KB
testcase_32 AC 113 ms
80,444 KB
testcase_33 AC 111 ms
80,848 KB
testcase_34 AC 113 ms
80,632 KB
testcase_35 AC 113 ms
80,704 KB
testcase_36 AC 113 ms
80,856 KB
testcase_37 AC 114 ms
80,540 KB
testcase_38 AC 116 ms
80,660 KB
testcase_39 AC 119 ms
80,660 KB
testcase_40 AC 111 ms
80,208 KB
testcase_41 AC 112 ms
80,368 KB
testcase_42 AC 97 ms
77,428 KB
testcase_43 AC 98 ms
76,996 KB
testcase_44 AC 109 ms
80,544 KB
testcase_45 AC 98 ms
77,100 KB
testcase_46 AC 107 ms
80,656 KB
testcase_47 AC 111 ms
80,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
M=70
DP=[[[0]*(M+1) for i in range(M+1)] for j in range(M+1)]
DP[0][0][0]=1
mod=998244353
for i in range(1,M+1):
  for j in range(M):
    for k in range(j,M):
      if (K>>(M-i))&1:
        if (N>>(M-i))&1:
          DP[i][0][k-j+1]=(DP[i][0][k-j+1]+DP[i-1][j][k])%mod
        DP[i][j+1][k+1]=(DP[i][j+1][k+1]+DP[i-1][j][k])%mod
      else:
        if (N>>(M-i))&1:
          DP[i][j+1][k+1]=(DP[i][j+1][k+1]+DP[i-1][j][k])%mod
        DP[i][0][k]=(DP[i][0][k]+DP[i-1][j][k])%mod
ANS=0
T=[1]
for i in range(M+1):
  T.append(T[i]*2%mod)
for i in range(M+1):
  for j in range(M+1):
    ANS+=DP[M][i][j]*T[j]%mod
print(ANS%mod)
0