結果

問題 No.2716 Falcon Method
ユーザー ニックネーム
提出日時 2024-04-05 21:54:39
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 416 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 30,328 KB
最終ジャッジ日時 2024-10-01 02:10:17
合計ジャッジ時間 13,853 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14 WA * 4 RE * 10
権限があれば一括ダウンロードができます

ソースコード

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