結果

問題 No.2537 多重含意
ユーザー momoyuu
提出日時 2023-11-10 21:59:30
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 642 bytes
コンパイル時間 3,182 ms
コンパイル使用メモリ 247,924 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-26 01:30:29
合計ジャッジ時間 4,846 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

#include<atcoder/modint>

using mint = atcoder::modint;
int main(){
    
    int n,b;
    cin>>n>>b;
    mint::set_mod(b);

    int cnt = 0;
    vector<int> now(n,0);
    vector<int> a(n);
    for(int i = 0;i<n;i++) cin>>a[i];
    bool ok = true;

    for(int i = 0;i<n;i++){
        a[i]--;
        now[a[i]]++;
        if(now[a[0]]>1) ok = false;
        if(i==0){
            mint ans = mint(2).pow(n-1);
            cout<<ans.val()<<endl;
            continue;
        }
        mint ans = mint(2).pow(n);
        if(ok) ans -= 1;
        cout<<ans.val()<<endl;
    }
}
0