結果

問題 No.1206 OR, OR, OR......
ユーザー 37zigen37zigen
提出日時 2020-08-30 13:53:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 869 ms
コンパイル使用メモリ 10,544 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-08-09 12:03:23
合計ジャッジ時間 1,718 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,812 KB
testcase_01 AC 17 ms
7,788 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 17 ms
7,848 KB
testcase_04 AC 17 ms
7,780 KB
testcase_05 AC 17 ms
7,972 KB
testcase_06 AC 16 ms
7,868 KB
testcase_07 AC 15 ms
7,788 KB
testcase_08 AC 15 ms
7,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD=998244353
T=int(input())
for _ in range(T):
    N,M=map(int,input().split())

    # Sum[i=0,..,k] C(k,i)(-1)^i 2^(k-i)M = (2^M-1)^k

    # Sum[k=1,..,N] C(N,k) * (2^M-1)^k * k = x * d/dx (1+x)^N
    # = Nx(1+x)^{N-1} = N*2^{M(N-1)} * (2^M-1)

    ans=N*pow(2,M*(N-1),MOD)%MOD*(pow(2,M,MOD)-1)%MOD

    print(ans)

0