結果

問題 No.2537 多重含意
ユーザー maksim
提出日時 2023-11-10 23:07:29
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 1,871 ms
コンパイル使用メモリ 171,844 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-09-26 02:09:50
合計ジャッジ時間 3,951 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n,p;cin>>n>>p;int a[n];for(int i=0;i<n;++i) cin>>a[i];
    int po[n+1]={1};for(int i=0;i<n;++i) {po[i+1]=(2*po[i])%p;} po[0]%=p;
    set<int> h;int answ=0;
    for(int i=0;i<n;++i)
    {
        int u=po[n];
        int v=0;
        if(h.count(a[i])) {v=0;}
        else {v=po[n-h.size()-1];}
        h.insert(a[i]);
        cout<<((u-v)%p+p)%p<<endl;
    }
    return 0;
}
0