結果

問題 No.2716 Falcon Method
ユーザー tailstails
提出日時 2024-04-05 22:08:44
言語 cLay
(20240104-1)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 2,884 ms
コンパイル使用メモリ 176,116 KB
実行使用メモリ 15,420 KB
最終ジャッジ日時 2024-04-05 22:08:50
合計ジャッジ時間 5,148 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,616 KB
testcase_01 AC 2 ms
7,616 KB
testcase_02 AC 2 ms
7,616 KB
testcase_03 AC 2 ms
7,616 KB
testcase_04 AC 3 ms
7,616 KB
testcase_05 AC 2 ms
7,616 KB
testcase_06 AC 2 ms
7,616 KB
testcase_07 AC 2 ms
7,616 KB
testcase_08 AC 3 ms
7,616 KB
testcase_09 AC 3 ms
7,616 KB
testcase_10 AC 3 ms
7,616 KB
testcase_11 AC 47 ms
15,024 KB
testcase_12 AC 39 ms
14,888 KB
testcase_13 AC 34 ms
14,888 KB
testcase_14 AC 47 ms
14,144 KB
testcase_15 AC 39 ms
14,620 KB
testcase_16 AC 44 ms
14,016 KB
testcase_17 AC 48 ms
14,272 KB
testcase_18 AC 55 ms
14,612 KB
testcase_19 AC 42 ms
13,868 KB
testcase_20 AC 34 ms
14,656 KB
testcase_21 AC 39 ms
14,128 KB
testcase_22 AC 38 ms
15,420 KB
testcase_23 AC 43 ms
15,420 KB
testcase_24 AC 34 ms
15,420 KB
testcase_25 AC 2 ms
7,616 KB
testcase_26 AC 3 ms
7,616 KB
testcase_27 AC 34 ms
15,420 KB
testcase_28 AC 34 ms
15,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@n,@q;
string@s;
ll ax[2n+1],ay[2n+1];
ax[0]=0;
ay[0]=0;
rep(i,2n){
	if(s[i%n]=='D'){
		ax[i+1]=ax[i]+1;
		ay[i+1]=ay[i];
	}else{
		ax[i+1]=ax[i];
		ay[i+1]=ay[i]+1;
	}
}
rep(q){
	ll@h,@w,@p,z;
	if(ax[n]==0||ay[n]!=0&&(h-1)/ax[n]>(w-1)/ay[n]){
		w=(w-1)%ay[n]+1;
		z=bsearch_min[ll,j,p,p+n](ay[j]-ay[p]>=w);
	}
	else if(ay[n]==0||ax[n]!=0&&(h-1)/ax[n]<(w-1)/ay[n]){
		h=(h-1)%ax[n]+1;
		z=bsearch_min[ll,j,p,p+n](ax[j]-ax[p]>=h);
	}
	else{
		h=(h-1)%ax[n]+1;
		w=(w-1)%ay[n]+1;
		z=bsearch_min[ll,j,p,p+n](ax[j]-ax[p]>=h||ay[j]-ay[p]>=w);
	}
	wt(z%n);
}
0