結果

問題 No.2716 Falcon Method
ユーザー kk0414kk0414
提出日時 2024-04-05 23:02:04
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 559 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 102,712 KB
最終ジャッジ日時 2024-04-05 23:02:13
合計ジャッジ時間 8,645 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,460 KB
testcase_01 RE -
testcase_02 WA -
testcase_03 AC 39 ms
53,460 KB
testcase_04 AC 39 ms
53,460 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 AC 70 ms
70,456 KB
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 405 ms
102,692 KB
testcase_13 WA -
testcase_14 AC 449 ms
96,752 KB
testcase_15 AC 361 ms
99,816 KB
testcase_16 AC 455 ms
96,756 KB
testcase_17 AC 452 ms
96,888 KB
testcase_18 WA -
testcase_19 AC 412 ms
96,764 KB
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 547 ms
99,616 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 502 ms
102,712 KB
testcase_28 AC 539 ms
102,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left as bl
n,Q = map(int,input().split())
rS = [0]
dS = [0]
pr = 0
pd = 0
for s in input():
    if s=="R":
        pr += 1
    elif s == "D":
        pd += 1
    rS.append(pr)
    dS.append(pd)
hmod = dS[-1]
wmod = rS[-1]

for _ in range(Q):
    h,w,p = map(int,input().split())
    h += dS[p]
    w += rS[p]
    hbase,wbase = h // hmod, w // wmod
    hm,wm = h%hmod, w%wmod
    hidx = bl(dS,hm)
    widx = bl(rS,wm)
    # print(hidx,widx)

    if hbase*n + hidx >= wbase*n + widx:
        print(widx)

    else:
        print(hidx)
0