結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kuuso1kuuso1
提出日時 2015-04-16 23:56:39
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 78 ms / 5,000 ms
コード長 1,205 bytes
コンパイル時間 2,267 ms
コンパイル使用メモリ 105,720 KB
実行使用メモリ 23,052 KB
最終ジャッジ日時 2023-09-11 11:01:09
合計ジャッジ時間 4,617 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
22,684 KB
testcase_01 AC 59 ms
20,568 KB
testcase_02 AC 59 ms
22,764 KB
testcase_03 AC 58 ms
20,744 KB
testcase_04 AC 59 ms
20,608 KB
testcase_05 AC 59 ms
20,648 KB
testcase_06 AC 58 ms
18,528 KB
testcase_07 AC 76 ms
18,860 KB
testcase_08 AC 76 ms
20,980 KB
testcase_09 AC 73 ms
20,828 KB
testcase_10 AC 74 ms
21,168 KB
testcase_11 AC 77 ms
21,048 KB
testcase_12 AC 58 ms
18,512 KB
testcase_13 AC 57 ms
20,716 KB
testcase_14 AC 68 ms
21,080 KB
testcase_15 AC 78 ms
23,052 KB
testcase_16 AC 58 ms
20,632 KB
testcase_17 AC 68 ms
20,960 KB
testcase_18 AC 75 ms
22,960 KB
testcase_19 AC 67 ms
20,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Array.Sort(A,(x,y)=>x>y?-1:x<y?1:0);
		for(int i=0;i<N;i++){
			if(A[i]==0)continue;
			int bit=0;
			for(int j=0;j<16;j++){
				if(((A[i]>>j)&1)>0)bit=j;
			}

			for(int j=i+1;j<N;j++){
				if(((A[j]>>bit)&1)>0)A[j]^=A[i];
			}
			Array.Sort(A,(x,y)=>x>y?-1:x<y?1:0);
		}
		int cnt=0;
		for(int i=0;i<N;i++){
			if(A[i]!=0)cnt++;
		}
		Console.WriteLine(1L<<cnt);
		
		
	}
	int N;
	int[] A;
	public Sol(){
		N=ri();
		A=ria();
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0