結果
問題 | No.184 たのしい排他的論理和(HARD) |
ユーザー | YS55749378 |
提出日時 | 2022-03-30 13:01:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 496 ms / 5,000 ms |
コード長 | 916 bytes |
コンパイル時間 | 1,858 ms |
コンパイル使用メモリ | 173,596 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-14 13:00:34 |
合計ジャッジ時間 | 12,587 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <stdio.h> #include <utility> #include <cmath> #include <cstdlib> #include <ctime> #include <cstdio> #include <bits/stdc++.h> using namespace std; #define REP2(i,m,n) for(long i=(long)m;i<(long)n;++i) #define REP(i,n) REP2(i,0,n) void yesno(bool flag){ cout<<(flag?"Yes":"No")<<endl; } vector<long> binary_xor_elimination(long v[],long n){ sort(v,v+n); reverse(v,v+n); vector<long> res; REP(i,n){ long b=63; while(b>=0 && ((1LL<<b & v[i])==0)) b--; if(b!=-1){ res.push_back(b); REP2(j,i+1,n){ if(1LL<<b & v[j]) v[j]^=v[i]; } sort(v+i+1,v+n); reverse(v+i+1,v+n); } } return res; } int main(){ long n; cin>>n; long a[n]; REP(i,n) cin>>a[i]; vector<long> res=binary_xor_elimination(a,n); long l=res.size(); cout<<(1LL<<l)<<endl; return 0; }