結果

問題 No.2097 AND^k
コンテスト
ユーザー NP
提出日時 2023-04-08 18:43:55
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
MLE  
実行時間 -
コード長 802 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 469 ms
コンパイル使用メモリ 20,728 KB
実行使用メモリ 1,311,836 KB
最終ジャッジ日時 2026-04-19 17:44:45
合計ジャッジ時間 7,317 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 MLE * 1
other MLE * 1 -- * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import itertools

MOD = 998244353

def generate_sequences(N, M):
    for A in itertools.product(range(2**M), repeat=N):
        yield A

def bitwise_and(A):
    res = A[0]
    for i in range(1, len(A)):
        res &= A[i]
    return res

def pow_mod(base, exponent, mod):
    res = 1
    while exponent > 0:
        if exponent % 2 == 1:
            res = (res * base) % mod
        base = (base * base) % mod
        exponent //= 2
    return res
def main():
    N, M, L = map(int, input().split())

    sequences = list(generate_sequences(N, M))
    
    for k in range(1, L+1):
        total = 0
        for A in sequences:
            and_result = bitwise_and(A)
            total += pow_mod(and_result, k, MOD)
            total %= MOD
        print(total)

if __name__ == '__main__':
    main()
0