結果

問題 No.130 XOR Minimax
ユーザー pekempeypekempey
提出日時 2015-08-20 19:10:22
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 636 bytes
コンパイル時間 1,137 ms
コンパイル使用メモリ 143,976 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-25 13:55:05
合計ジャッジ時間 3,935 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 18 ms
4,380 KB
testcase_05 AC 45 ms
4,376 KB
testcase_06 AC 30 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 42 ms
4,376 KB
testcase_09 AC 6 ms
4,376 KB
testcase_10 AC 8 ms
4,376 KB
testcase_11 WA -
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 21 ms
4,376 KB
testcase_14 AC 35 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 25 ms
4,376 KB
testcase_17 AC 26 ms
4,380 KB
testcase_18 AC 28 ms
4,376 KB
testcase_19 AC 34 ms
4,376 KB
testcase_20 AC 16 ms
4,380 KB
testcase_21 AC 35 ms
4,376 KB
testcase_22 WA -
testcase_23 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define repr(i, a) for (int i = (a) - 1; i >= 0; i--)
#define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--)
using namespace std;
typedef long long ll;
const ll inf = 1e9;
const ll mod = 1e9 + 7;

int N;
ll a[100000];

int main() {
	cin >> N;
	rep (i, N) cin >> a[i];
	ll lb = *max_element(a, a + N);

	ll x = 0;
	repr (i, 32) {
		ll maxv = 0;
		ll y = x | (1ll << i);
		rep (j, N) {
			maxv = max(maxv, a[j] ^ y);
		}
		if (maxv < lb) {
			lb = maxv;
			x = y;
		}
	}

	cout << lb << endl;

	return 0;
}
0