結果
問題 | No.184 たのしい排他的論理和(HARD) |
ユーザー |
|
提出日時 | 2017-02-25 01:22:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 356 ms / 5,000 ms |
コード長 | 908 bytes |
コンパイル時間 | 794 ms |
コンパイル使用メモリ | 75,888 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 12:17:51 |
合計ジャッジ時間 | 7,620 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #define repeat(i,n) for (int i = 0; (i) < int(n); ++(i)) #define repeat_reverse(i,n) for (int i = (n)-1; (i) >= 0; --(i)) #define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) using namespace std; uint64_t bit(int i) { return 1ull << i; } void add(vector<uint64_t> & xs, uint64_t y) { for (uint64_t x : xs) { repeat_reverse (i,64) { if (not (x & bit(i)) and not (y & bit(i))) continue; if ((x & bit(i)) and (y & bit(i))) y ^= x; break; } } if (y) { xs.push_back(y); whole(sort, xs); whole(reverse, xs); } } int main() { int n; cin >> n; vector<uint64_t> acc; repeat (i,n) { uint64_t a; cin >> a; add(acc, a); } cout << (1ll << acc.size()) << endl; return 0; }