結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2020-07-07 02:09:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 681 ms / 5,000 ms |
コード長 | 445 bytes |
コンパイル時間 | 1,947 ms |
コンパイル使用メモリ | 197,856 KB |
最終ジャッジ日時 | 2025-01-11 16:35:19 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector<int> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; } vector<bool> dp(1 << 15, false); dp[0] = true; for (int i = 0; i < N; i++) { for (int j = 0; j < (1 << 15); j++) { dp[j ^ A[i]] = dp[j ^ A[i]] | dp[j]; } } cout << count(dp.begin(), dp.end(), true) << '\n'; return 0; }