結果
問題 | No.1082 XORのXOR |
ユーザー | tails |
提出日時 | 2020-11-09 21:26:37 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 883 bytes |
コンパイル時間 | 344 ms |
コンパイル使用メモリ | 32,128 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-22 16:21:21 |
合計ジャッジ時間 | 1,364 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,944 KB |
testcase_02 | AC | 1 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 1 ms
6,940 KB |
testcase_06 | AC | 1 ms
6,940 KB |
testcase_07 | AC | 1 ms
6,940 KB |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | AC | 1 ms
6,940 KB |
testcase_10 | AC | 1 ms
6,940 KB |
testcase_11 | AC | 1 ms
6,944 KB |
testcase_12 | AC | 1 ms
6,944 KB |
testcase_13 | AC | 1 ms
6,944 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 1 ms
6,944 KB |
testcase_16 | AC | 1 ms
6,944 KB |
testcase_17 | AC | 2 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,940 KB |
testcase_20 | AC | 1 ms
6,940 KB |
testcase_21 | AC | 1 ms
6,940 KB |
testcase_22 | AC | 1 ms
6,944 KB |
testcase_23 | AC | 1 ms
6,944 KB |
testcase_24 | AC | 1 ms
6,940 KB |
testcase_25 | AC | 1 ms
6,944 KB |
testcase_26 | AC | 1 ms
6,944 KB |
testcase_27 | AC | 1 ms
6,944 KB |
testcase_28 | AC | 0 ms
6,944 KB |
testcase_29 | AC | 1 ms
6,940 KB |
testcase_30 | AC | 0 ms
6,940 KB |
testcase_31 | AC | 1 ms
6,940 KB |
コンパイルメッセージ
main.c: In function 'sort1b': main.c:9:5: warning: type of 'b' defaults to 'int' [-Wimplicit-int] 9 | int sort1b(b,l,r){ | ^~~~~~ main.c:9:5: warning: type of 'l' defaults to 'int' [-Wimplicit-int] main.c:9:5: warning: type of 'r' defaults to 'int' [-Wimplicit-int] main.c: At top level: main.c:28:1: warning: return type defaults to 'int' [-Wimplicit-int] 28 | f(p,al,ar,bl,br){ | ^ main.c: In function 'f': main.c:28:1: warning: type of 'p' defaults to 'int' [-Wimplicit-int] main.c:28:1: warning: type of 'al' defaults to 'int' [-Wimplicit-int] main.c:28:1: warning: type of 'ar' defaults to 'int' [-Wimplicit-int] main.c:28:1: warning: type of 'bl' defaults to 'int' [-Wimplicit-int] main.c:28:1: warning: type of 'br' defaults to 'int' [-Wimplicit-int] main.c:29:27: warning: 'return' with no value, in function returning non-void 29 | if(al==ar|bl==br) return; | ^~~~~~ main.c:28:1: note: declared here 28 | f(p,al,ar,bl,br){ | ^ main.c:34:17: warning: 'return' with no value, in function returning non-void 34 | return; | ^~~~~~ main.c:28:1: note: declared here 28 | f(p,al,ar,bl,br){ | ^ main.c: At top level: main.c:47:1: warning: return type defaults to 'int' [-Wimplicit-int] 47 | main(){ | ^~~~ main.c: In function 'main': main.c:57:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 57 | printf("%d",maxv); | ^~~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf' +++ |+#include <stdio.h> 1 | #pragma GCC optimize("Ofast") main.c:57:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] 57 | printf("%d",maxv); | ^~~~~~ main.c:57: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 a[2000]; int sort1b(b,l,r){ int ml=l; int mr=r; while(1){ while(ml<mr&&!(a[ml]&b)){ ++ml; } while(ml<mr&&(a[mr-1]&b)){ --mr; } if(ml==mr) return ml; int t=a[ml]; a[ml]=a[mr-1]; a[mr-1]=t; } } int maxv; f(p,al,ar,bl,br){ if(al==ar|bl==br) return; if(p<0) { if(maxv<(a[al]^a[bl])){ maxv=a[al]^a[bl]; } return; } int b=1<<p; int am=sort1b(b,al,ar); int bm=sort1b(b,bl,br); if(am==al&bm==bl|am==ar&bm==br){ f(p-1,al,ar,bl,br); }else{ f(p-1,al,am,bm,br); f(p-1,am,ar,bl,bm); } } main(){ char*rp=mmap(0l,11l*2001,1,2,0,0ll); RD(n); for(int i=0;i<n;++i){ RD(t); a[i]=t; } int p=29; int m; while(p>=0&&(m=sort1b(1<<p,0,n),m==0|m==n))--p; if(p>=0) f(p-1,0,m,m,n); printf("%d",maxv); }