結果

問題 No.2716 Falcon Method
ユーザー ニックネームニックネーム
提出日時 2024-04-05 21:54:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 416 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 29,548 KB
最終ジャッジ日時 2024-04-05 21:54:55
合計ジャッジ時間 13,112 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
10,112 KB
testcase_01 RE -
testcase_02 AC 26 ms
10,112 KB
testcase_03 AC 24 ms
10,112 KB
testcase_04 AC 24 ms
10,112 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 32 ms
10,112 KB
testcase_08 AC 36 ms
10,112 KB
testcase_09 AC 33 ms
10,112 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 739 ms
28,880 KB
testcase_13 AC 640 ms
28,924 KB
testcase_14 AC 855 ms
25,708 KB
testcase_15 AC 677 ms
28,116 KB
testcase_16 WA -
testcase_17 AC 897 ms
26,496 KB
testcase_18 WA -
testcase_19 AC 792 ms
25,448 KB
testcase_20 AC 637 ms
27,860 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 1,098 ms
29,540 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 WA -
testcase_28 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left
n,q = map(int,input().split())
s = input()*2; d = [0]; r = [0]
for v in s:
    d.append(d[-1]); r.append(r[-1])
    if v=="D": d[-1] += 1
    else: r[-1] += 1
for _ in range(q):
    h,w,p = map(int,input().split())
    d1,d2 = divmod(h,d[n]); d3 = max(bisect_left(d,d[p]+d2),p)
    r1,r2 = divmod(w,r[n]); r3 = max(bisect_left(r,r[p]+r2),p)
    print(d3%n if (d1,d3)<(r1,r3) else r3%n)
0