結果

問題 No.2000 Distanced Characters
ユーザー tailstails
提出日時 2022-07-08 22:57:19
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 7 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 742 ms
コンパイル使用メモリ 27,040 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 22:45:20
合計ジャッジ時間 1,687 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 7 ms
4,376 KB
testcase_09 AC 7 ms
4,376 KB
testcase_10 AC 7 ms
4,376 KB
testcase_11 AC 7 ms
4,376 KB
testcase_12 AC 4 ms
4,380 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 AC 6 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:36:2: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  write(1,wbuf,26*26*2);
  ^~~~~
main.c:37:2: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  _exit(0);
  ^~~~~
main.c:37:2: warning: incompatible implicit declaration of built-in function ‘_exit’

ソースコード

diff #

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

#define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define rep(v,e) for(long v=0;v<e;++v)

char wbuf[1<<25];
long d[26][26];
long a[26];

int main(){
	rep(x,26){
		a[x]=-1<<20;
	}
	char*mmap();
	char*rp=mmap(0l,1l<<25,1,2,0,0ll);
	char*s=rp;
	while(*rp++>='a');
	char*wp=wbuf;
	rep(y,26){
		rep(x,26){
			d[y][x]=rd();
			*wp++='Y';
			*wp++=' ';
		}
		wp[-1]='\n';
	}
	for(long i=0,c;c=*s++-'a',c>=0;){
		rep(e,26){
			if(d[e][c]>i-a[e]){
				wbuf[e*52+c*2]='N';
			}
		}
		a[c]=i++;
	}
	write(1,wbuf,26*26*2);
	_exit(0);
}
0