結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,384 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 13 ms
6,792 KB
testcase_03 AC 14 ms
6,820 KB
testcase_04 AC 13 ms
6,820 KB
testcase_05 AC 10 ms
6,724 KB
testcase_06 AC 16 ms
6,976 KB
testcase_07 AC 13 ms
6,568 KB
testcase_08 AC 4 ms
4,384 KB
testcase_09 AC 13 ms
6,592 KB
testcase_10 AC 8 ms
6,344 KB
testcase_11 AC 9 ms
5,984 KB
testcase_12 AC 11 ms
6,548 KB
testcase_13 AC 16 ms
6,896 KB
testcase_14 AC 12 ms
6,708 KB
testcase_15 AC 31 ms
7,056 KB
testcase_16 AC 52 ms
7,268 KB
testcase_17 AC 10 ms
6,216 KB
testcase_18 AC 14 ms
6,732 KB
testcase_19 AC 9 ms
6,348 KB
testcase_20 AC 18 ms
6,940 KB
testcase_21 AC 7 ms
5,932 KB
testcase_22 AC 45 ms
7,404 KB
testcase_23 AC 45 ms
7,408 KB
testcase_24 AC 49 ms
7,404 KB
testcase_25 AC 43 ms
7,432 KB
testcase_26 AC 48 ms
7,360 KB
testcase_27 AC 41 ms
7,424 KB
testcase_28 AC 45 ms
7,412 KB
testcase_29 AC 49 ms
7,296 KB
testcase_30 AC 47 ms
7,292 KB
testcase_31 AC 39 ms
7,288 KB
testcase_32 AC 42 ms
7,332 KB
testcase_33 AC 44 ms
7,292 KB
testcase_34 AC 48 ms
7,372 KB
testcase_35 AC 43 ms
7,344 KB
testcase_36 AC 46 ms
7,348 KB
testcase_37 AC 40 ms
7,420 KB
testcase_38 AC 36 ms
7,300 KB
testcase_39 AC 45 ms
7,332 KB
testcase_40 AC 45 ms
7,436 KB
testcase_41 AC 42 ms
7,348 KB
testcase_42 AC 18 ms
7,020 KB
testcase_43 AC 17 ms
7,032 KB
testcase_44 AC 18 ms
6,964 KB
testcase_45 AC 17 ms
7,016 KB
testcase_46 AC 18 ms
6,964 KB
testcase_47 AC 14 ms
6,760 KB
testcase_48 AC 14 ms
6,756 KB
testcase_49 AC 14 ms
6,788 KB
testcase_50 AC 14 ms
6,704 KB
testcase_51 AC 15 ms
6,776 KB
testcase_52 AC 6 ms
4,384 KB
testcase_53 AC 6 ms
4,380 KB
testcase_54 AC 5 ms
4,384 KB
testcase_55 AC 9 ms
4,888 KB
testcase_56 AC 8 ms
5,020 KB
testcase_57 AC 8 ms
5,004 KB
testcase_58 AC 3 ms
4,380 KB
testcase_59 AC 18 ms
7,388 KB
testcase_60 AC 3 ms
4,384 KB
testcase_61 AC 8 ms
5,108 KB
testcase_62 AC 5 ms
5,284 KB
testcase_63 AC 2 ms
4,384 KB
testcase_64 AC 3 ms
4,380 KB
testcase_65 AC 5 ms
5,816 KB
testcase_66 AC 8 ms
5,032 KB
testcase_67 AC 3 ms
4,380 KB
testcase_68 AC 5 ms
4,888 KB
testcase_69 AC 3 ms
4,384 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 19
#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