結果

問題 No.2716 Falcon Method
ユーザー PNJPNJ
提出日時 2024-04-05 22:37:59
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 498 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 80,404 KB
最終ジャッジ日時 2024-04-05 22:38:11
合計ジャッジ時間 5,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 RE -
testcase_11 RE -
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 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 322 ms
80,404 KB
testcase_28 AC 325 ms
80,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q = map(int,input().split())
S = input()
HH = [0 for j in range(N+1)]
WW = [0 for j in range(N+1)]
h,w = 0,0
for i in range(N):
  if S[i] == 'D':
    h += 1
    HH[h] = i
  else:
    w += 1
    WW[w] = i
for _ in range(Q):
  H,W,P = map(int,input().split())
  hh = H % h
  if hh == 0:
    hh += h
  th = ((H - hh) // h)*N + HH[hh]
  ww = W % w
  if ww == 0:
    ww += w
  tw = ((W - ww) // w)*N + WW[ww]
  ans = (th + 1) % N
  if tw < th:
    ans = (tw + 1) % N
  ans += P
  ans %= N
  print(ans)
0