結果

問題 No.130 XOR Minimax
ユーザー tnakao0123tnakao0123
提出日時 2016-03-21 01:38:21
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 967 bytes
コンパイル時間 736 ms
コンパイル使用メモリ 84,636 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 21:11:52
合計ジャッジ時間 2,938 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 19 ms
6,548 KB
testcase_05 AC 47 ms
6,548 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 130.cc: No.130 XOR Minimax - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;
const int MAX_B = 31;

/* typedef */

/* global variables */

int as[MAX_N], zs[MAX_B], os[MAX_B];

/* subroutines */

/* main */

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> as[i];

  for (int i = 0; i < n; i++) {
    int &ai = as[i];
    for (int j = 0, bj = 1; j < MAX_B; j++, bj <<= 1) {
      if (ai & bj) os[j]++;
      else zs[j]++;
    }
  }

  int ans = 0;
  for (int j = 0, bj = 1; j < MAX_B; j++, bj <<= 1)
    if (zs[j] && os[j]) ans |= bj;

  printf("%d\n", ans);
  return 0;
}
0