結果

問題 No.2061 XOR Sort
ユーザー publfl2publfl2
提出日時 2022-08-26 22:44:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 439 ms / 2,000 ms
コード長 806 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 55,112 KB
実行使用メモリ 27,688 KB
最終ジャッジ日時 2024-04-22 00:49:13
合計ジャッジ時間 6,154 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 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 2 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 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 193 ms
15,244 KB
testcase_15 AC 181 ms
14,772 KB
testcase_16 AC 414 ms
27,036 KB
testcase_17 AC 240 ms
18,424 KB
testcase_18 AC 265 ms
18,660 KB
testcase_19 AC 245 ms
18,492 KB
testcase_20 AC 35 ms
6,004 KB
testcase_21 AC 101 ms
9,988 KB
testcase_22 AC 202 ms
14,956 KB
testcase_23 AC 5 ms
5,376 KB
testcase_24 AC 439 ms
27,424 KB
testcase_25 AC 422 ms
27,656 KB
testcase_26 AC 426 ms
27,688 KB
testcase_27 AC 425 ms
27,536 KB
testcase_28 AC 436 ms
27,672 KB
testcase_29 AC 40 ms
11,248 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 6 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 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 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