結果
| 問題 |
No.130 XOR Minimax
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-09-15 01:35:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 578 bytes |
| コンパイル時間 | 482 ms |
| コンパイル使用メモリ | 58,744 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 06:33:01 |
| 合計ジャッジ時間 | 1,724 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 WA * 4 |
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<unsigned int> a(n, 0);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
unsigned int xx = 0;
unsigned int max0, max1;
for (int i = 30; i >= 0; i--) {
unsigned int x0 = xx;
unsigned int x1 = xx + (1 << i);
max0 = 0;
max1 = 0;
for (int j = 0; j < n; j++) {
max0 = max(max0, a[j] ^ x0);
max1 = max(max1, a[j] ^ x1);
}
xx = max0 < max1 ? x0 : x1;
}
int unsigned ans = max0 < max1 ? max0 : max1;
cout << ans << endl;
return 0;
}