結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー tailstails
提出日時 2022-10-18 11:13:19
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 38 ms / 3,000 ms
コード長 993 bytes
コンパイル時間 991 ms
コンパイル使用メモリ 25,368 KB
実行使用メモリ 19,720 KB
最終ジャッジ日時 2023-09-11 05:52:42
合計ジャッジ時間 7,955 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 27 ms
19,084 KB
testcase_03 AC 29 ms
19,044 KB
testcase_04 AC 27 ms
19,080 KB
testcase_05 AC 22 ms
18,104 KB
testcase_06 AC 28 ms
19,236 KB
testcase_07 AC 32 ms
19,044 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 30 ms
18,916 KB
testcase_10 AC 18 ms
15,880 KB
testcase_11 AC 22 ms
18,380 KB
testcase_12 AC 25 ms
18,744 KB
testcase_13 AC 33 ms
19,196 KB
testcase_14 AC 25 ms
18,896 KB
testcase_15 AC 28 ms
19,292 KB
testcase_16 AC 34 ms
19,496 KB
testcase_17 AC 27 ms
18,568 KB
testcase_18 AC 34 ms
19,024 KB
testcase_19 AC 23 ms
18,504 KB
testcase_20 AC 34 ms
19,352 KB
testcase_21 AC 7 ms
6,280 KB
testcase_22 AC 36 ms
19,584 KB
testcase_23 AC 37 ms
19,720 KB
testcase_24 AC 36 ms
19,696 KB
testcase_25 AC 37 ms
19,668 KB
testcase_26 AC 36 ms
19,652 KB
testcase_27 AC 37 ms
19,700 KB
testcase_28 AC 37 ms
19,624 KB
testcase_29 AC 36 ms
19,684 KB
testcase_30 AC 38 ms
19,668 KB
testcase_31 AC 37 ms
19,580 KB
testcase_32 AC 37 ms
19,688 KB
testcase_33 AC 37 ms
19,580 KB
testcase_34 AC 37 ms
19,708 KB
testcase_35 AC 36 ms
19,716 KB
testcase_36 AC 36 ms
19,700 KB
testcase_37 AC 36 ms
19,660 KB
testcase_38 AC 36 ms
19,668 KB
testcase_39 AC 37 ms
19,684 KB
testcase_40 AC 37 ms
19,672 KB
testcase_41 AC 37 ms
19,700 KB
testcase_42 AC 34 ms
19,192 KB
testcase_43 AC 35 ms
19,200 KB
testcase_44 AC 33 ms
19,240 KB
testcase_45 AC 34 ms
19,292 KB
testcase_46 AC 34 ms
19,400 KB
testcase_47 AC 35 ms
19,116 KB
testcase_48 AC 34 ms
19,020 KB
testcase_49 AC 33 ms
19,064 KB
testcase_50 AC 34 ms
19,120 KB
testcase_51 AC 35 ms
19,068 KB
testcase_52 AC 6 ms
4,380 KB
testcase_53 AC 6 ms
4,384 KB
testcase_54 AC 5 ms
4,380 KB
testcase_55 AC 12 ms
5,980 KB
testcase_56 AC 12 ms
6,032 KB
testcase_57 AC 12 ms
5,996 KB
testcase_58 AC 4 ms
4,380 KB
testcase_59 AC 35 ms
19,572 KB
testcase_60 AC 2 ms
4,380 KB
testcase_61 AC 12 ms
5,972 KB
testcase_62 AC 9 ms
9,396 KB
testcase_63 AC 2 ms
4,380 KB
testcase_64 AC 2 ms
4,380 KB
testcase_65 AC 7 ms
7,464 KB
testcase_66 AC 12 ms
6,052 KB
testcase_67 AC 3 ms
4,388 KB
testcase_68 AC 6 ms
5,740 KB
testcase_69 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:57:14: warning: multi-character character constant [-Wmultichar]
    *(int*)wp='\noN';
              ^~~~~~
main.c:62:14: warning: multi-character character constant [-Wmultichar]
    *(int*)wp='\nseY';
              ^~~~~~~
main.c:69:2: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  write(1,wbuf,wp-wbuf);
  ^~~~~
main.c:70:2: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  _exit(0);
  ^~~~~
main.c:70:2: warning: incompatible implicit declaration of built-in function ‘_exit’

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rd_skip() while(*rp++>=48)

typedef unsigned long ulong;
char wbuf[1<<25];

#define HASH_BITS 21
#define HASH_MASK ((1<<HASH_BITS)-1)
ulong hash[1<<HASH_BITS];

int main(){
	char*mmap();
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	rd_skip();
	char*wp=wbuf;
	while(*rp){
		ulong h=0;
		long c;
		while(c=*rp++,c!=10){
			h=h*27+c;
		}
		ulong aa=~0;
		{
			ulong a=h&HASH_MASK;
			while(1){
				if(hash[a]==h){
					goto yes;
				}
				if(hash[a]==0){
					aa=a;
					break;
				}
				a=a+1&HASH_MASK;
			}
		}
		char*p=rp-1;
		long b=*--p;
		ulong m=26;
		while(c=*--p,c!=10){
			ulong h2=h+(b-c)*m;
			ulong a=h2&HASH_MASK;
			while(1){
				if(hash[a]==h2){
					goto yes;
				}
				if(hash[a]==0){
					break;
				}
				a=a+1&HASH_MASK;
			}
			m*=27;
			b=c;
		}
		if(1){
			*(int*)wp='\noN';
			wp+=3;
		}
		if(0){
			yes:;
			*(int*)wp='\nseY';
			wp+=4;
		}
		if(~aa){
			hash[aa]=h;
		}
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0