結果
| 問題 | 
                            No.130 XOR Minimax
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tails
                         | 
                    
| 提出日時 | 2020-10-28 10:08:09 | 
| 言語 | C  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 12 ms / 5,000 ms | 
| コード長 | 608 bytes | 
| コンパイル時間 | 405 ms | 
| コンパイル使用メモリ | 31,104 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-12 22:58:56 | 
| 合計ジャッジ時間 | 1,491 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
コンパイルメッセージ
main.c:35:1: warning: return type defaults to 'int' [-Wimplicit-int]
   35 | main(){
      | ^~~~
main.c: In function 'main':
main.c:42:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   42 |         printf("%d",f(1<<29,0,n));
      |         ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
  +++ |+#include <stdio.h>
    1 | #pragma GCC optimize("Ofast")
main.c:42:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   42 |         printf("%d",f(1<<29,0,n));
      |         ^~~~~~
main.c:42:9: note: include '<stdio.h>' or provide a declaration of 'printf'
            
            ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
char*mmap();
#define RD(v) int v=0;{int c;while(c=*rp++-48,c>=0)v=v*10+c;}
int o[100000];
int f(int m,int a,int b){
	if(m==0||a+1==b) return 0;
	int c=a;
	int d=b;
	l1:;
	while(o[c]&m){
		++c;
		if(c==d) goto l2;
	}
	while(~o[--d]&m){
		if(c==d) goto l2;
	}
	int t=o[c];
	o[c]=o[d];
	o[d]=t;
	goto l1;
	l2:;
	if(c==a||c==b) return f(m>>1,a,b);
	int z0=f(m>>1,a,c);
	int z1=f(m>>1,c,b);
	return m|(z0<=z1?z0:z1);
}
main(){
	char*rp=mmap(0l,1200l<<10,1,2,0,0ll);
	RD(n);
	for(int i=0;i<n;++i){
		RD(x);
		o[i]=x;
	}
	printf("%d",f(1<<29,0,n));
}
            
            
            
        
            
tails