結果

問題 No.130 XOR Minimax
ユーザー %20%20
提出日時 2017-09-11 16:19:21
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 331 bytes
コンパイル時間 2,064 ms
コンパイル使用メモリ 201,972 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-10 00:20:23
合計ジャッジ時間 3,784 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 17 ms
4,352 KB
testcase_05 AC 42 ms
4,352 KB
testcase_06 AC 29 ms
4,356 KB
testcase_07 AC 40 ms
4,352 KB
testcase_08 AC 41 ms
4,348 KB
testcase_09 AC 6 ms
4,352 KB
testcase_10 AC 9 ms
4,352 KB
testcase_11 AC 31 ms
4,352 KB
testcase_12 AC 4 ms
4,348 KB
testcase_13 AC 24 ms
4,352 KB
testcase_14 AC 41 ms
4,352 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 29 ms
4,352 KB
testcase_17 AC 31 ms
4,352 KB
testcase_18 AC 32 ms
4,348 KB
testcase_19 AC 39 ms
4,352 KB
testcase_20 AC 19 ms
4,352 KB
testcase_21 AC 41 ms
4,352 KB
testcase_22 AC 10 ms
4,348 KB
testcase_23 AC 4 ms
4,356 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:16:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
   16 | 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;
	}
	if((a[l]^a[r-1])&1<<s){
		int m;
		for(m=l;!(a[m]&1<<s);++m);
		return 1<<s|min(f(s-1,l,m),f(s-1,m,r));
	}else{
		return f(s-1,l,r);
	}
}
main(){
	cin>>N;
	for(int i=0;cin>>a[i++];);
	sort(a,a+N);
	cout<<f(29,0,N);
}
0