結果

問題 No.2061 XOR Sort
ユーザー 沙耶花沙耶花
提出日時 2022-08-26 22:57:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 759 bytes
コンパイル時間 4,181 ms
コンパイル使用メモリ 253,756 KB
最終ジャッジ日時 2025-01-31 05:28:10
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001


int main() {
	
	int n;
	cin>>n;
	vector<vector<int>> a(1);
	rep(i,n){
		int x;
		cin>>x;
		a[0].push_back(x);
	}
	long long ans = 1;
	for(int i=29;i>=0;i--){
		bool f = false;
		vector<vector<int>> b;
		rep(j,a.size()){
			vector<int> t[2];
			rep(k,a[j].size()){
				t[(a[j][k]>>i)&1].push_back(a[j][k]);
			}
			if(t[0].size()!=0&&t[1].size()!=0)f = true;
			if(t[0].size()!=0)b.push_back(t[0]);
			if(t[1].size()!=0)b.push_back(t[1]);
		}
		swap(a,b);
		if(f)ans *= 2;
	}
	cout<<ans<<endl;
    return 0;
}
0