結果

問題 No.2000 Distanced Characters
ユーザー tailstails
提出日時 2022-07-08 22:26:51
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 925 ms
コンパイル使用メモリ 28,580 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 22:09:28
合計ジャッジ時間 1,850 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 0 ms
4,380 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 0 ms
4,376 KB
testcase_05 AC 0 ms
4,376 KB
testcase_06 AC 1 ms
4,500 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 5 ms
4,376 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 4 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:32:2: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
  write(1,wbuf,wp-wbuf);
  ^~~~~
main.c:33:2: warning: implicit declaration of function ‘_exit’ [-Wimplicit-function-declaration]
  _exit(0);
  ^~~~~
main.c:33: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)
#define chmin(v,a) (v=v<=a?v:a)

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

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