結果

問題 No.2716 Falcon Method
ユーザー hiryuNhiryuN
提出日時 2024-04-05 21:57:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 725 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 103,792 KB
最終ジャッジ日時 2024-04-05 21:57:56
合計ジャッジ時間 9,351 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 33 ms
53,460 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 32 ms
53,460 KB
testcase_06 AC 54 ms
70,956 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 60 ms
70,952 KB
testcase_11 AC 516 ms
103,612 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 423 ms
97,564 KB
testcase_22 AC 525 ms
103,792 KB
testcase_23 WA -
testcase_24 AC 546 ms
103,788 KB
testcase_25 AC 31 ms
53,460 KB
testcase_26 AC 32 ms
53,460 KB
testcase_27 AC 478 ms
102,752 KB
testcase_28 AC 505 ms
102,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,Q=map(int,input().split())
s=input()
R=[0]
D=[0]
for i in s:
    if i=="R":
        R.append(R[-1]+1)
        D.append(D[-1])
    else:
        D.append(D[-1]+1)
        R.append(R[-1])
def Rco(start,dist):
    g=start+dist
    syu=g//n
    div=g%n
    return R[-1]*syu+R[div]-R[start]
def Dco(start,dist):
    g=start+dist
    syu=g//n
    div=g%n
    return D[-1]*syu+D[div]-D[start]
        
for i in range(Q):
    d,r,p=map(int,input().split())
    ans=0
    for bs in reversed(range(40)):
        ans+=2**bs
        if Dco(p,ans)>d or Rco(p,ans)>r or (Dco(p,ans)>=d and Rco(p,ans)>=r):
            ans-=2**bs
    print((p+ans)%n)
"""
for i in range(5):
    for j in range(5):
        print(Rco(i,j))
    print("#")
"""
0