結果

問題 No.2307 [Cherry 5 th Tune *] Cool 46
コンテスト
ユーザー 👑 tails
提出日時 2023-05-24 20:55:07
言語 C90(gcc15)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,989 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 124 ms
コンパイル使用メモリ 29,240 KB
最終ジャッジ日時 2026-02-24 01:14:06
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'main':
main.c:50:21: error: expected ';' before 'j'
   50 |                 rep(j,n){
      |                     ^
main.c:12:32: note: in definition of macro 'rep'
   12 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:50:21: error: 'j' undeclared (first use in this function)
   50 |                 rep(j,n){
      |                     ^
main.c:12:36: note: in definition of macro 'rep'
   12 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:50:21: note: each undeclared identifier is reported only once for each function it appears in
   50 |                 rep(j,n){
      |                     ^
main.c:12:36: note: in definition of macro 'rep'
   12 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:56:21: error: expected ';' before 'j'
   56 |                 rep(j,m){
      |                     ^
main.c:12:32: note: in definition of macro 'rep'
   12 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:66:40: warning: multi-character character constant [-Wmultichar]
   66 |                         *(unsigned*)wp='\noN';
      |                                        ^~~~~~
main.c:73:35: warning: multi-character character constant [-Wmultichar]
   73 |                         *(int*)wp='\nseY';
      |                                   ^~~~~~~
main.c:79:49: warning: multi-character character constant [-Wmultichar]
   79 |                                         wt_red(h);
      |                                                 ^
main.c:84:41: warning: multi-character character constant [-Wmultichar]
   84 |                                 wt_red(h);
      |                                         ^
main.c:85:42: warning: multi-character character constant [-Wmultichar]
   85 |                                 wt_blue(h);
      |                                     

ソースコード

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_skip() while(*rp++>=48)
#define rd() ({long _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define WTHI(v) {ulong _z=v,_n=0,_d=0;while(++_n,_d=_d<<8|0x30|_z%10,_z/=10);*(ulong*)wp=_d;wp+=_n;}
#define WTLO(v) {ulong _z=v,_n=8,_d=0;while(_d=_d<<8|0x30|_z%10,_z/=10,--_n);*(ulong*)wp=_d;wp+=8;}
#define wt(v) if(v>=100000000){WTHI(v/100000000);WTLO(v);}else{WTHI(v);}
#define wt_red(h) ({*(unsigned*)wp=' deR';wp+=4;wt(hash[h]);*wp++='\n';})
#define wt_blue(h) ({*(unsigned*)wp='eulB';wp+=4;;*wp++=' ';wt(hash[h]);*wp++='\n';})
#define rep(v,e) for(typeof(e) v=0;v<e;++v)

#define HASH_BITS 18
#define HASH_MASK ((1<<HASH_BITS)-1)
unsigned hash[1<<HASH_BITS];

int hash_add(unsigned x){
	int h=x&HASH_MASK;
	while(1){
		if(hash[h]==0){
			hash[h]=x;
			return h;
		}
		if(hash[h]==x){
			return h;
		}
		h=h+1&HASH_MASK;
	}
}

typedef unsigned long ulong;
char wbuf[1<<25];

char u[1<<18];
int as[1<<18],an;
int bs[1<<18],bn;
int cs[1<<18],cn;

int main(){
	rd_init();
	rd_skip();
	char*wp=wbuf;
	while(*rp){
		an=0;
		bn=0;
		cn=0;
		int n=rd(),m=rd();
		if(!n)++rp;
		rep(j,n){
			int h=hash_add(rd());
			u[h]=1;
			as[an++]=h;
		}
		if(!m)++rp;
		rep(j,m){
			int h=hash_add(rd());
			if(u[h]){
				u[h]=0;
				cs[cn++]=h;
			}else{
				bs[bn++]=h;
			}
		}
		if(cn==0&&an&&bn){
			*(unsigned*)wp='\noN';
			wp+=3;
			while(an){
				int h=as[--an];
				u[h]=0;
			}
		}else{
			*(int*)wp='\nseY';
			wp+=4;
			while(an){
				int h=as[--an];
				if(u[h]){
					u[h]=0;
					wt_red(h);
				}
			}
			if(cn){
				int h=cs[--cn];
				wt_red(h);
				wt_blue(h);
			}
			while(bn){
				int h=bs[--bn];
				wt_blue(h);
			}
			while(1){
				if(!cn)break;
				{
					int h=cs[--cn];
					wt_blue(h);
					wt_red(h);
				}
				if(!cn)break;
				{
					int h=cs[--cn];
					wt_red(h);
					wt_blue(h);
				}
			}
		}
	}
	write(1,wbuf,wp-wbuf);
	_exit(0);
}
0