結果

問題 No.130 XOR Minimax
ユーザー %20%20
提出日時 2017-09-11 17:04:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 332 bytes
コンパイル時間 2,153 ms
コンパイル使用メモリ 197,048 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 06:46:09
合計ジャッジ時間 3,806 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 17 ms
5,376 KB
testcase_05 AC 47 ms
5,376 KB
testcase_06 AC 30 ms
5,376 KB
testcase_07 AC 46 ms
5,376 KB
testcase_08 AC 85 ms
5,376 KB
testcase_09 AC 7 ms
5,376 KB
testcase_10 AC 10 ms
5,376 KB
testcase_11 AC 34 ms
5,376 KB
testcase_12 AC 5 ms
5,376 KB
testcase_13 AC 27 ms
5,376 KB
testcase_14 AC 68 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 48 ms
5,376 KB
testcase_17 AC 52 ms
5,376 KB
testcase_18 WA -
testcase_19 AC 64 ms
5,376 KB
testcase_20 WA -
testcase_21 AC 68 ms
5,376 KB
testcase_22 AC 17 ms
5,376 KB
testcase_23 AC 6 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int N,a[100000],m;
int f(int s,int l,int r){
	if(s<0){
		return 0;
	}
	m=lower_bound(a+l,a+r,a[l]&-(1<<s)|1<<s)-a;
	if(m==l||m==r){
		return f(s-1,l,r);
	}else{
		return 1<<s|min(f(s-1,l,m),f(s-1,m,r));
	}
}
main(){
	cin>>N;
	for(int i=0;cin>>a[i++];);
	sort(a,a+N);
	cout<<f(29,0,N);
}
0