結果

問題 No.2000 Distanced Characters
コンテスト
ユーザー 👑 tails
提出日時 2022-07-08 22:26:51
言語 C90
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 617 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 80 ms
コンパイル使用メモリ 26,168 KB
最終ジャッジ日時 2026-02-24 01:09:04
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'main':
main.c:5:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    5 | #define rep(v,e) for(long v=0;v<e;++v)
      |                  ^~~
main.c:13:9: note: in expansion of macro 'rep'
   13 |         rep(y,26)rep(x,26)f[y][x]=1<<20;
      |         ^~~
main.c:5:18: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
    5 | #define rep(v,e) for(long v=0;v<e;++v)
      |                  ^~~
main.c:13:9: note: in expansion of macro 'rep'
   13 |         rep(y,26)rep(x,26)f[y][x]=1<<20;
      |         ^~~
main.c:5:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    5 | #define rep(v,e) for(long v=0;v<e;++v)
      |                  ^~~
main.c:13:18: note: in expansion of macro 'rep'
   13 |         rep(y,26)rep(x,26)f[y][x]=1<<20;
      |                  ^~~
main.c:14:13: error: redefinition of 'x'
   14 |         rep(x,26)a[x]=-1<<20;
      |             ^
main.c:5:27: note: in definition of macro 'rep'
    5 | #define rep(v,e) for(long v=0;v<e;++v)
      |                           ^
main.c:13:22: note: previous definition of 'x' with type 'long int'
   13 |         rep(y,26)rep(x,26)f[y][x]=1<<20;
      |                      ^
main.c:5:27: note: in definition of macro 'rep'
    5 | #define rep(v,e) for(long v=0;v<e;++v)
      |                           ^
main.c:5:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    5 | #define rep(v,e) for(long v=0;v<e;++v)
      |                  ^~~
main.c:14:9: note: in expansion of macro 'rep'
   14 |         rep(x,26)a[x]=-1<<20;
      |         ^~~
main.c:17:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   17 |         for(long i=0,c;c=*rp++-'a',c>=0;){
      |         ^~~
main.c:5:18: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    5 | #define rep(v,e) for(long v=0;v<e;++v)
      |                  ^~~
mai

ソースコード

diff #
raw source code

#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