結果

問題 No.2537 多重含意
ユーザー Kude
提出日時 2023-11-10 21:58:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 87,680 KB
最終ジャッジ日時 2024-09-26 01:28:53
合計ジャッジ時間 2,453 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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