結果

問題 No.130 XOR Minimax
ユーザー %20%20
提出日時 2017-09-11 17:03:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 52 ms / 5,000 ms
コード長 334 bytes
コンパイル時間 2,029 ms
コンパイル使用メモリ 200,344 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-10 00:20:44
合計ジャッジ時間 3,854 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 16 ms
4,352 KB
testcase_05 AC 42 ms
4,348 KB
testcase_06 AC 29 ms
4,352 KB
testcase_07 AC 41 ms
4,348 KB
testcase_08 AC 52 ms
4,348 KB
testcase_09 AC 7 ms
4,348 KB
testcase_10 AC 10 ms
4,352 KB
testcase_11 AC 31 ms
4,352 KB
testcase_12 AC 4 ms
4,348 KB
testcase_13 AC 25 ms
4,352 KB
testcase_14 AC 51 ms
4,356 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 37 ms
4,348 KB
testcase_17 AC 37 ms
4,348 KB
testcase_18 AC 40 ms
4,352 KB
testcase_19 AC 48 ms
4,348 KB
testcase_20 AC 24 ms
4,348 KB
testcase_21 AC 51 ms
4,348 KB
testcase_22 AC 12 ms
4,352 KB
testcase_23 AC 5 ms
4,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:15:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   15 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int N,a[100000];
int f(int s,int l,int r){
	if(s<0){
		return 0;
	}
	int 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