結果
| 問題 |
No.130 XOR Minimax
|
| コンテスト | |
| ユーザー |
%20
|
| 提出日時 | 2017-09-11 17:02:12 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 90 ms / 5,000 ms |
| コード長 | 343 bytes |
| コンパイル時間 | 2,268 ms |
| コンパイル使用メモリ | 195,720 KB |
| 最終ジャッジ日時 | 2025-01-05 02:54:30 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
main.cpp:15:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
15 | main(){
| ^~~~
ソースコード
#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=lower_bound(a+l,a+r,a[l]&-(1<<s)|1<<s)-a;
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);
}
%20