結果

問題 No.1896 Arrays and XOR Procedure 2
ユーザー tailstails
提出日時 2022-04-08 22:45:46
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 7,830 ms
コンパイル使用メモリ 197,888 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-06 08:23:57
合計ジャッジ時間 7,625 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 3 ms
5,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 4 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 3 ms
5,376 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

ll c[6000],n;

VI res;
void ent(ll p,ll q){
	res.push_back(p+1);
	res.push_back(q+1);
	swap(c[p],c[q+n]);
}

{
	rd(n);
	ll@d[2n];
	c[0..2n-1]=d[0..];
	sortF(2n,d);
	ll i=0,j=0;
	while(i<n&&j<n){
		while(i<n&&c[i]<=d[n-1])++i;
		while(j<n&&c[j+n]>=d[n])++j;
		if(i<n&&j<n){
			ent(i,j);
		}
	}
	if(i<n){
		j=0;
		while(i<n){
			while(i<n&&c[i]<=d[n-1])++i;
			while(j<n&&c[j+n]>d[n-1])++j;
			if(i<n){
				ent(i,j);
			}
		}
	}
	if(j<n){
		i=0;
		while(j<n){
			while(i<n&&c[i]<d[n])++i;
			while(j<n&&c[j+n]>=d[n])++j;
			if(j<n){
				ent(i,j);
			}
		}
	}
	wt((ll)(res.size()/2*3));
	rep(i,0,res.size(),2){
		wt(1,res[i],res[i+1]);
		wt(2,res[i],res[i+1]);
		wt(1,res[i],res[i+1]);
	}
}
0