結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
![]() |
提出日時 | 2021-01-28 21:21:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 141 ms / 5,000 ms |
コード長 | 432 bytes |
コンパイル時間 | 1,644 ms |
コンパイル使用メモリ | 168,596 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 05:27:11 |
合計ジャッジ時間 | 3,543 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } vector<int> dp(1 << 15 , 0); dp[0] = 1; for(int i = 0; i < n; i++){ for(int j = 0; j < (1 << 15); j++){ if(dp[j] == 1){ dp[j ^ a[i]] = 1; } } } int ans = 0; for(int i = 0; i < (1 << 15); i++){ ans += dp[i]; } cout << ans << endl; return 0; }