結果

問題 No.2537 多重含意
コンテスト
ユーザー Kude
提出日時 2023-11-10 21:59:10
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 551 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 280 ms
コンパイル使用メモリ 85,120 KB
実行使用メモリ 92,416 KB
最終ジャッジ日時 2026-04-13 04:20:43
合計ジャッジ時間 2,660 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n, b = map(int, input().split())
a = [-1] * n
rest = n
ans = 0
done = False
for x in map(int, input().split()):
    x -= 1
    res = ans
    if not done:
        if a[x] == 1:
            res = (res + pow(2, rest, b)) % b
        elif a[x] == -1:
            res = (res + pow(2, rest - 1, b)) % b
    print(res)
    if not done:
        if a[x] == -1:
            ans = (ans + pow(2, rest - 1, b)) % b
            a[x] = 1
            rest -= 1
        else:
            if a[x] == 0:
                ans += pow(2, rest, b)
                done = True
0