結果
問題 | No.184 たのしい排他的論理和(HARD) |
ユーザー | YS55749378 |
提出日時 | 2022-03-29 15:59:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 461 ms / 5,000 ms |
コード長 | 855 bytes |
コンパイル時間 | 2,082 ms |
コンパイル使用メモリ | 174,116 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 09:17:24 |
合計ジャッジ時間 | 11,337 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;}int main(){long n;cin >> n;long a[n];REP(i,n) cin >> a[i];sort(a,a+n);reverse(a,a+n);set<long> ans_list;REP(i,n){long b=62;while(b>=0 && ((1LL<<b & a[i])==0)) b--;if(b!=-1){REP2(j,i+1,n){if(1LL<<b & a[j]) a[j]^=a[i];}sort(a+i+1,a+n);reverse(a+i+1,a+n);ans_list.insert(b);//cout << b << "th bit" << endl;}}long l=ans_list.size();cout << (1LL<<l) << endl;return 0;}