結果

問題 No.1328 alligachi-problem
ユーザー tailstails
提出日時 2020-12-25 01:03:26
言語 cLay
(20240104-1)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 736 bytes
コンパイル時間 2,326 ms
コンパイル使用メモリ 168,680 KB
実行使用メモリ 13,608 KB
最終ジャッジ日時 2023-09-19 01:59:24
合計ジャッジ時間 10,991 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
11,492 KB
testcase_01 AC 3 ms
11,592 KB
testcase_02 AC 3 ms
11,576 KB
testcase_03 AC 3 ms
9,372 KB
testcase_04 AC 3 ms
11,584 KB
testcase_05 AC 4 ms
11,496 KB
testcase_06 AC 3 ms
11,480 KB
testcase_07 AC 4 ms
11,560 KB
testcase_08 AC 3 ms
11,424 KB
testcase_09 AC 44 ms
13,092 KB
testcase_10 AC 35 ms
12,448 KB
testcase_11 AC 43 ms
13,268 KB
testcase_12 AC 44 ms
13,152 KB
testcase_13 AC 43 ms
13,356 KB
testcase_14 AC 43 ms
13,184 KB
testcase_15 AC 34 ms
12,264 KB
testcase_16 AC 43 ms
13,152 KB
testcase_17 AC 44 ms
13,228 KB
testcase_18 AC 44 ms
13,096 KB
testcase_19 AC 43 ms
13,108 KB
testcase_20 AC 43 ms
13,104 KB
testcase_21 AC 44 ms
13,224 KB
testcase_22 AC 43 ms
13,356 KB
testcase_23 AC 35 ms
12,436 KB
testcase_24 AC 36 ms
13,608 KB
testcase_25 AC 36 ms
13,388 KB
testcase_26 AC 33 ms
12,760 KB
testcase_27 AC 34 ms
11,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

struct S {
	int y,i;
};
bool operator<(S const&a, S const&b){
	return a.y<b.y;
}

S es[4][2d5];
int en[4],er[4],lr,lb;
int aa[2d5];

{
	int @n;
	rep(i,n){
		string @c,@x;
		int @y;
		int k=(c=="R"?0:2)|(x=="R"?0:1);
		es[k][en[k]++]={y,i};
	}
	rep(k,4){
		sort(es[k],es[k]+en[k]);
	}
	rep(i,n){
		int a0=(er[0]<en[0]&&es[0][er[0]].y==lr);
		int a1=(er[1]<en[1]&&es[1][er[1]].y==lb);
		int a2=(er[2]<en[2]&&es[2][er[2]].y==lr);
		int a3=(er[3]<en[3]&&es[3][er[3]].y==lb);
		int a=(a0?1:0)|(a1?2:0)|(a2?4:0)|(a3?8:0);
		if(a0) a&=~2;
		if(a1) a&=~4&~8;
		if(a2) a&=~1&~2;
		if(a3) a&=~4;
		int k=a&1?0:a&2?1:a&4?2:a&8?3:-1;
		if(k<0){
			wt("No");
			exit(0);
		}
		aa[i]=es[k][er[k]++].i+1;
		++(k<2?lr:lb);
	}
	wt("Yes");
	wt(aa(n));
}
0