結果

問題 No.2061 XOR Sort
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-08-04 21:10:11
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 251 ms / 2,000 ms
コード長 921 bytes
コンパイル時間 5,935 ms
コンパイル使用メモリ 336,456 KB
実行使用メモリ 16,744 KB
最終ジャッジ日時 2024-04-22 19:20:27
合計ジャッジ時間 10,231 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 103 ms
9,744 KB
testcase_15 AC 120 ms
9,752 KB
testcase_16 AC 231 ms
16,508 KB
testcase_17 AC 140 ms
11,500 KB
testcase_18 AC 140 ms
11,740 KB
testcase_19 AC 132 ms
11,512 KB
testcase_20 AC 18 ms
5,376 KB
testcase_21 AC 54 ms
6,912 KB
testcase_22 AC 102 ms
9,848 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 244 ms
16,616 KB
testcase_25 AC 248 ms
16,744 KB
testcase_26 AC 244 ms
16,616 KB
testcase_27 AC 246 ms
16,620 KB
testcase_28 AC 251 ms
16,620 KB
testcase_29 AC 61 ms
14,976 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 7 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 1 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 1 ms
5,376 KB
testcase_38 AC 1 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 1 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
	int n;cin>>n;
	set<int>s;
	rep(i,n){
		int a;cin>>a;
		s.insert(a);
	}
	vc<int>v;
	for(auto au:s)v.pb(au);
	int t=30;
	vc<bool>bo(t,false);
	auto f=[&](auto f,int a,vc<int>x)->void{
		if(a==-1)return;
		vc<int>z,o;
		for(auto au:x){
			if(au>>a&1)o.pb(au);
			else z.pb(au);
		}
	    if(o.size()&&z.size())bo[a]=true;
	    if((int)z.size()>1)f(f,a-1,z); 
	    if((int)o.size()>1)f(f,a-1,o);
		return;
	};
	f(f,t-1,v);
	int k=0; rep(i,t)if(bo[i])k++;
	mint ans=mint(2).pow(k);
	cout<<ans.val();
}
0