結果

問題 No.2061 XOR Sort
ユーザー publfl2publfl2
提出日時 2022-08-26 22:44:20
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 356 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 53,920 KB
実行使用メモリ 28,172 KB
最終ジャッジ日時 2023-08-04 02:17:36
合計ジャッジ時間 5,940 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 166 ms
14,436 KB
testcase_15 AC 161 ms
14,004 KB
testcase_16 AC 356 ms
26,584 KB
testcase_17 AC 215 ms
17,652 KB
testcase_18 AC 215 ms
17,824 KB
testcase_19 AC 214 ms
17,664 KB
testcase_20 AC 34 ms
5,064 KB
testcase_21 AC 96 ms
9,296 KB
testcase_22 AC 166 ms
14,712 KB
testcase_23 AC 5 ms
4,376 KB
testcase_24 AC 352 ms
28,172 KB
testcase_25 AC 329 ms
27,512 KB
testcase_26 AC 330 ms
27,168 KB
testcase_27 AC 327 ms
27,664 KB
testcase_28 AC 329 ms
27,748 KB
testcase_29 AC 36 ms
10,352 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 6 ms
4,376 KB
testcase_32 AC 1 ms
4,384 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 1 ms
4,376 KB
testcase_42 AC 1 ms
4,380 KB
testcase_43 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <vector>
#define MOD 998244353

std::vector< std::vector<int> > V1,V2;
std::vector<int> temp1, temp2;

int x[200010];
int count[110];
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	
	long long int ans = 1;
	for(int i=1;i<=a;i++) temp1.push_back(x[i]);
	V1.push_back(temp1);
	for(int j=30;j>=0;j--)
	{
		V2.clear();
		for(int i=0;i<V1.size();i++)
		{
			temp1.clear();
			temp2.clear();
			for(int k=0;k<V1[i].size();k++)
			{
				if(((V1[i][k]>>j)&1)==0) temp1.push_back(V1[i][k]);
				else temp2.push_back(V1[i][k]);
			}
			if(temp1.size()>0) V2.push_back(temp1);
			if(temp2.size()>0) V2.push_back(temp2);
		}
		if(V1.size()<V2.size()) ans*=2;
		V1.clear();
		for(int i=0;i<V2.size();i++) V1.push_back(V2[i]);
	}
	
	printf("%lld",ans%MOD);
}
0