結果

問題 No.2537 多重含意
ユーザー flygonflygon
提出日時 2023-11-10 22:33:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 535 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 106,240 KB
最終ジャッジ日時 2024-09-26 01:54:55
合計ジャッジ時間 2,957 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(5*10**5)
input = sys.stdin.readline
from collections import defaultdict, deque, Counter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right
from math import gcd

n,b = map(int,input().split())
a = list(map(int,input().split()))

s = set([a[0]])
ans = [pow(2, n-1, b)]
all = pow(2, n, b)

for i in range(1,n):
    if a[i] in s:
        ans.append(all)
    else:
        s.add(a[i])
        tmp = all - (pow(2, n-len(s), b))
        ans.append(tmp%b)
print(*ans, sep = "\n")
0