結果

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

コンパイルメッセージ
main.c: In function 'main':
main.c:12:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   12 |         for(int a,b;a=*s++,b=*t++,a!=10;){
      |         ^~~
main.c:12:9: note: use option '-std=c99', '-std=gnu99', '-std=c11' or '-std=gnu11' to compile your code
main.c:22:17: error: redeclaration of 'a' with no linkage
   22 |         for(int a,b;a=*s++,b=*t++,a!=10;){
      |                 ^
main.c:12:17: note: previous declaration of 'a' with type 'int'
   12 |         for(int a,b;a=*s++,b=*t++,a!=10;){
      |                 ^
main.c:22:19: error: redeclaration of 'b' with no linkage
   22 |         for(int a,b;a=*s++,b=*t++,a!=10;){
      |                   ^
main.c:12:19: note: previous declaration of 'b' with type 'int'
   12 |         for(int a,b;a=*s++,b=*t++,a!=10;){
      |                   ^
main.c:22:9: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   22 |         for(int a,b;a=*s++,b=*t++,a!=10;){
      |         ^~~

ソースコード

diff #
raw source code

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

#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})

int main(){
	rd_init();
	int n=rd();
	char*s=rp;
	char*t=rp+(n+1);
	for(int a,b;a=*s++,b=*t++,a!=10;){
		if(a-b){
			goto differ;
		}
	}
	goto yes;
	differ:;
	--s;
	--t;
	int ab=0,bc=0;
	for(int a,b;a=*s++,b=*t++,a!=10;){
		if(a>b){
			goto no;
		}
		ab+=a=='A'&&b=='B';
		bc+=a=='B'&&b=='C';
	}
	if(ab&&ab==bc){
		yes:;
		write(1,"Yes",3);
	}else{
		no:;
		write(1,"No",2);
	}
	_exit(0);
}
0