結果
問題 | No.2537 多重含意 |
ユーザー |
![]() |
提出日時 | 2023-11-24 12:12:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 2,174 ms |
コンパイル使用メモリ | 198,464 KB |
最終ジャッジ日時 | 2025-02-17 23:37:07 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include <bits/stdc++.h>using namespace std;void fast_io() {ios::sync_with_stdio(false);std::cin.tie(nullptr);}int main() {fast_io();int n, b;cin >> n >> b;vector<int> a(n);for (int i = 0; i < n; i++) {cin >> a[i];}vector<int> pow2(n + 1, 1);for (int i = 1; i <= n; i++) {pow2[i] = pow2[i - 1] * 2 % b;}set<int> used;for (int i = 0; i < n; i++) {if (used.count(a[i])) {cout << pow2[n] << "\n";} else {cout << ((pow2[n] - pow2[n - used.size() - 1]) % b + b) % b << "\n";}used.insert(a[i]);}}