結果
問題 | No.1082 XORのXOR |
ユーザー | tails |
提出日時 | 2020-11-09 21:44:36 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 875 bytes |
コンパイル時間 | 274 ms |
コンパイル使用メモリ | 32,128 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-22 16:21:43 |
合計ジャッジ時間 | 1,148 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 1 ms
6,944 KB |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 1 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,944 KB |
testcase_09 | AC | 1 ms
6,940 KB |
testcase_10 | AC | 1 ms
6,944 KB |
testcase_11 | AC | 1 ms
6,940 KB |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | AC | 1 ms
6,944 KB |
testcase_14 | AC | 1 ms
6,940 KB |
testcase_15 | AC | 1 ms
6,940 KB |
testcase_16 | AC | 1 ms
6,940 KB |
testcase_17 | AC | 1 ms
6,940 KB |
testcase_18 | AC | 1 ms
6,940 KB |
testcase_19 | AC | 1 ms
6,944 KB |
testcase_20 | AC | 1 ms
6,940 KB |
testcase_21 | AC | 1 ms
6,944 KB |
testcase_22 | AC | 1 ms
6,940 KB |
testcase_23 | AC | 2 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,940 KB |
testcase_27 | AC | 1 ms
6,940 KB |
testcase_28 | AC | 1 ms
6,944 KB |
testcase_29 | AC | 1 ms
6,940 KB |
testcase_30 | AC | 1 ms
6,940 KB |
testcase_31 | AC | 1 ms
6,944 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(b,al,ar,bl,br){ | ^ main.c: In function 'f': main.c:28:1: warning: type of 'b' 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(b,al,ar,bl,br){ | ^ main.c:30:38: warning: 'return' with no value, in function returning non-void 30 | if((a[al]^a[bl])+b+b-2<maxv) return; | ^~~~~~ main.c:28:1: note: declared here 28 | f(b,al,ar,bl,br){ | ^ main.c:33:17: warning: 'return' with no value, in function returning non-void 33 | return; | ^~~~~~ main.c:28:1: note: declared here 28 | f(b,al,ar,bl,br){ | ^ main.c: At top level: main.c:46:1: warning: return type defaults to 'int' [-Wimplicit-int] 46 | main(){ | ^~~~ main.c: In function 'main': main.c:56:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 56 | 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:56:9: warning: incompatible implicit declaration of built-in function 'print
ソースコード
#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(b,al,ar,bl,br){ if(al==ar|bl==br) return; if((a[al]^a[bl])+b+b-2<maxv) return; if(!b) { maxv=a[al]^a[bl]; return; } int am=sort1b(b,al,ar); int bm=sort1b(b,bl,br); b>>=1; if(am==al&bm==bl|am==ar&bm==br){ f(b,al,ar,bl,br); }else{ f(b,al,am,bm,br); f(b,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 b=1<<29; int m; while(b&&(m=sort1b(b,0,n),m==0|m==n))b>>=1; if(b) f(b>>1,0,m,m,n); printf("%d",maxv); }