結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,100 KB
testcase_01 RE -
testcase_02 WA -
testcase_03 AC 36 ms
52,228 KB
testcase_04 AC 36 ms
52,228 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 AC 68 ms
68,740 KB
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 394 ms
102,692 KB
testcase_13 WA -
testcase_14 AC 441 ms
96,752 KB
testcase_15 AC 362 ms
99,716 KB
testcase_16 AC 434 ms
96,756 KB
testcase_17 AC 446 ms
96,772 KB
testcase_18 WA -
testcase_19 AC 431 ms
96,764 KB
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 518 ms
99,616 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 472 ms
102,660 KB
testcase_28 AC 549 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%n)

    else:
        print(hidx%n)
0