結果

問題 No.130 XOR Minimax
コンテスト
ユーザー testestest
提出日時 2015-12-02 22:36:47
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 323 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 181 ms
コンパイル使用メモリ 29,992 KB
最終ジャッジ日時 2026-02-23 19:56:02
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | a[100000];
      | ^
main.c: In function ‘main’:
main.c:13:11: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
   13 | for(n=-2;~scanf("%d",++n+a););
      |           ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | a[100000];
main.c:15:9: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
   15 | return !printf("%d",x(a,n,29));
      |         ^~~~~~
main.c:15:9: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #
raw source code

a[100000];
c(int*a,int*b){return*a-*b;}

x(int*a,int n,int i){
if(i==-1)return 0;
if(~(*a^a[n-1])>>i&1)return x(a,n,i-1);
int l=0,u=n,m;
for(;u-l>1;a[m=(l+u)/2]>>i&1?u=m:(l=m));
return 1<<i|(l=x(a,u,i-1),l<(m=x(a+u,n-u,i-1))?l:m);
}

main(n){
for(n=-2;~scanf("%d",++n+a););
qsort(a,n,4,c);
return !printf("%d",x(a,n,29));
}
0