結果
問題 |
No.130 XOR Minimax
|
ユーザー |
|
提出日時 | 2021-05-23 03:33:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 707 bytes |
コンパイル時間 | 2,194 ms |
コンパイル使用メモリ | 194,688 KB |
最終ジャッジ日時 | 2025-01-21 17:30:25 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 WA * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; int n, t; vector <int> v; int cnt[31]; int main(void) { cin.tie(0); ios::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) { cin >> t; for (int j = 0; j <= 30; j++) { if ((t & (1LL << j))) { cnt[j]++; } } v.push_back(t); } long long int x = 0; for (int j = 0; j <= 30; j++) { if (cnt[j] == n) { x += (1LL << j); } } long long int res = 0; for (int i = 0; i < n; i++) { res = max(res, (v[i] ^ x)); } cout << res << '\n'; return 0; }