結果

問題 No.2537 多重含意
ユーザー GOTKAKOGOTKAKO
提出日時 2023-11-10 22:30:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 627 bytes
コンパイル時間 2,036 ms
コンパイル使用メモリ 207,152 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2023-11-10 22:30:23
合計ジャッジ時間 3,860 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,548 KB
testcase_01 AC 1 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 2 ms
6,548 KB
testcase_05 AC 1 ms
6,548 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
6,548 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    long long N,B; cin >> N >> B;
    vector<long long> power2(N+1,1),A(N);
    for(auto &a : A) cin >> a,a--;
    power2.at(0) %= B;
    for(int i=1; i<=N; i++) power2.at(i) = power2.at(i-1)*2%B;

    vector<bool> appear(N);
    long long all = power2.at(N);
    for(int i=0; i<N; i++){
        if(i == 0) cout << power2.at(N-1) << endl;
        else{
            if(appear.at(A.at(i))) cout << all << endl;
            else cout << (all-1+B)%B << endl;
        }
        appear.at(A.at(i)) = true;
    }
}
0