結果
問題 | No.2171 OR Assignment |
ユーザー | suisen |
提出日時 | 2022-12-23 01:15:15 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 213 ms / 3,500 ms |
コード長 | 1,209 bytes |
コンパイル時間 | 843 ms |
コンパイル使用メモリ | 87,288 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-04-29 05:51:22 |
合計ジャッジ時間 | 4,585 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | AC | 2 ms
5,376 KB |
testcase_06 | AC | 2 ms
5,376 KB |
testcase_07 | AC | 2 ms
5,376 KB |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 141 ms
5,376 KB |
testcase_13 | AC | 140 ms
5,376 KB |
testcase_14 | AC | 138 ms
5,376 KB |
testcase_15 | AC | 26 ms
5,376 KB |
testcase_16 | AC | 33 ms
5,376 KB |
testcase_17 | AC | 37 ms
5,376 KB |
testcase_18 | AC | 82 ms
5,376 KB |
testcase_19 | AC | 76 ms
5,376 KB |
testcase_20 | AC | 97 ms
5,376 KB |
testcase_21 | AC | 100 ms
5,376 KB |
testcase_22 | AC | 117 ms
5,376 KB |
testcase_23 | AC | 213 ms
5,376 KB |
testcase_24 | AC | 185 ms
5,376 KB |
testcase_25 | AC | 170 ms
5,376 KB |
testcase_26 | AC | 159 ms
5,376 KB |
testcase_27 | AC | 139 ms
5,376 KB |
testcase_28 | AC | 143 ms
5,376 KB |
testcase_29 | AC | 167 ms
5,376 KB |
testcase_30 | AC | 207 ms
5,376 KB |
testcase_31 | AC | 114 ms
5,376 KB |
ソースコード
#include <algorithm> #include <array> #include <iostream> #include <vector> #include <atcoder/modint> using mint = atcoder::modint998244353; constexpr int L = 30; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector<int> a(n); for (auto &&e : a) std::cin >> e; std::array<int, L> last; last.fill(-1); std::vector<int> ppos; std::vector<mint> pd { 1 }; for (int i = 0; i < n; ++i) { std::vector<int> pos; for (int j = 0; j < L; ++j) { if ((a[i] >> j) & 1) { last[j] = i; } else if (last[j] >= 0) { pos.push_back(last[j]); } } std::sort(pos.begin(), pos.end()); pos.erase(std::unique(pos.begin(), pos.end()), pos.end()); pos.push_back(i); const int siz = pos.size(); std::vector<mint> dp(siz + 1); for (int k = 0, j = 0; k < siz; ++k) { while (j < int(ppos.size()) and ppos[j] <= pos[k]) ++j; dp[k + 1] = dp[k] + pd[j]; } pd.swap(dp); ppos.swap(pos); } std::cout << pd.back().val() << std::endl; return 0; }