結果
| 問題 |
No.130 XOR Minimax
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2015-02-11 06:08:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 730 bytes |
| コンパイル時間 | 667 ms |
| コンパイル使用メモリ | 76,864 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-23 18:29:28 |
| 合計ジャッジ時間 | 2,933 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 6 |
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <sstream>
#include <map>
#include <string>
#include <algorithm>
#include <queue>
#include <cmath>
#include <set>
using namespace std;
int main(){
long long n;
cin >> n;
vector<long long> a(n);
for(int i=0; i<n; i++){
cin >> a[i];
}
auto get_max = [](vector<long long> v){
long long ret = -1;
for(int i=0; i<v.size(); i++){
ret = max(ret, v[i]);
}
return ret;
};
long long ans = 1LL<<60LL;
for(long long k=0; k<31; k++){
ans = min(ans, get_max(a));
auto b = a;
for(int i=0; i<n; i++){
b[i] ^= (1LL<<k);
}
long long tmp = get_max(b);
if(tmp < ans){
swap(a,b);
ans = tmp;
}
}
cout << ans << endl;
return 0;
}
koyumeishi