結果

問題 No.1328 alligachi-problem
ユーザー tails
提出日時 2020-12-25 13:15:29
言語 cLay
(20241019-1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 2,265 ms
コンパイル使用メモリ 178,252 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2024-07-05 14:53:43
合計ジャッジ時間 6,880 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

long es[4][2d5];
int en[4],er[4],l[2];
int aa[2d5];

{
	int @n;
	rep(i,n){
		char @c,@x;
		int @y;
		int k=(c=='R'?0:2)|(x=='R'?0:1);
		es[k][en[k]++]=(ll)y<<32|i;
	}
	rep(k,4){
		sort(es[k],es[k]+en[k]);
	}
	rep(i,n){
		int a=0,b=0;
		rep(k,4){
			if(er[k]<en[k]&&es[k][er[k]]>>32==l[k&1]){
				a|=1<<k;
				b|=(int[]){2,12,3,4}[k];
			}
		}
		int k=ffs(a&~b)-1;
		if(k<0){
			wt("No");
			exit(0);
		}
		aa[i]=es[k][er[k]++]+1;
		++l[k>>1];
	}
	wt("Yes");
	wt(aa(n));
}
0