結果

問題 No.130 XOR Minimax
ユーザー fiord
提出日時 2015-08-18 08:25:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 346 bytes
コンパイル時間 1,332 ms
コンパイル使用メモリ 158,304 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-18 10:09:26
合計ジャッジ時間 2,668 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;	cin>>n;
	int a[n],Max=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		Max=max(Max,a[i]);
	}
	int res=0;
	for(int i=30;i>=0;i--){
		int tem=0;
		for(int j=0;j<n;j++){
			tem=max(tem,(a[j]^(1<<i)^res));
		}
		if(Max>=tem){
			res+=(1<<i);
			Max=tem;
		}
	}
	cout<<Max<<endl;
	return 0;
}
0