結果
問題 |
No.2716 Falcon Method
|
ユーザー |
|
提出日時 | 2024-04-05 21:57:39 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 725 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 82,780 KB |
実行使用メモリ | 104,404 KB |
最終ジャッジ日時 | 2024-10-01 02:13:48 |
合計ジャッジ時間 | 10,921 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 12 WA * 16 |
ソースコード
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("#") """