結果

問題 No.2716 Falcon Method
ユーザー tailstails
提出日時 2024-04-05 21:59:01
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 2,934 ms
コンパイル使用メモリ 175,984 KB
実行使用メモリ 15,420 KB
最終ジャッジ日時 2024-04-05 21:59:07
合計ジャッジ時間 5,011 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 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 2 ms
7,616 KB
testcase_05 AC 2 ms
7,616 KB
testcase_06 AC 3 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 2 ms
7,616 KB
testcase_11 AC 59 ms
15,024 KB
testcase_12 AC 49 ms
14,888 KB
testcase_13 AC 42 ms
14,888 KB
testcase_14 AC 59 ms
14,144 KB
testcase_15 AC 47 ms
14,620 KB
testcase_16 WA -
testcase_17 AC 61 ms
14,272 KB
testcase_18 WA -
testcase_19 AC 51 ms
13,868 KB
testcase_20 AC 46 ms
14,656 KB
testcase_21 AC 50 ms
14,128 KB
testcase_22 AC 49 ms
15,420 KB
testcase_23 AC 59 ms
15,420 KB
testcase_24 AC 50 ms
15,420 KB
testcase_25 AC 2 ms
7,616 KB
testcase_26 AC 2 ms
7,616 KB
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

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/ax[n]>w/ay[n]){
		z=bsearch_min[ll,j,p,p+n](ay[j]-ay[p]>=w%ay[n]);
	}
	else if(ay[n]==0||ax[n]!=0&&h/ax[n]<w/ay[n]){
		z=bsearch_min[ll,j,p,p+n](ax[j]-ax[p]>=h%ax[n]);
	}
	else{
		z=bsearch_min[ll,j,p,p+n](ax[j]-ax[p]>=h%ax[n]||ay[j]-ay[p]>=w%ay[n]);
	}
	wt(z%n);
}
0