結果
問題 | No.184 たのしい排他的論理和(HARD) |
ユーザー |
|
提出日時 | 2015-04-17 02:17:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 368 ms / 5,000 ms |
コード長 | 654 bytes |
コンパイル時間 | 1,536 ms |
コンパイル使用メモリ | 159,972 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 11:19:14 |
合計ジャッジ時間 | 8,137 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) #define FOR(i, f, t) for(int(i)=(f);(i)<(t);(++i)) int N; ll A[111111]; int main(){ do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0); cin >> N; REP(i,N) cin >> A[i]; sort(A, A+N, greater<ll>()); int res = 0; REP(i,N){ if(A[i] == 0) break; res++; ll x = 1LL<<(64-__builtin_clzll(A[i])-1); FOR(j,i+1,N){ if(!(A[j]&x))break; A[j] ^= A[i]; } sort(A+i+1, A+N, greater<ll>()); } cout << (1LL<<res) << endl; }