結果
問題 | No.2716 Falcon Method |
ユーザー | kk0414 |
提出日時 | 2024-04-05 23:27:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 775 bytes |
コンパイル時間 | 2,771 ms |
コンパイル使用メモリ | 81,444 KB |
実行使用メモリ | 103,676 KB |
最終ジャッジ日時 | 2024-04-05 23:29:10 |
合計ジャッジ時間 | 19,696 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,460 KB |
testcase_01 | AC | 35 ms
53,460 KB |
testcase_02 | WA | - |
testcase_03 | AC | 36 ms
53,460 KB |
testcase_04 | AC | 37 ms
53,460 KB |
testcase_05 | AC | 38 ms
53,460 KB |
testcase_06 | AC | 66 ms
68,256 KB |
testcase_07 | WA | - |
testcase_08 | AC | 70 ms
70,328 KB |
testcase_09 | WA | - |
testcase_10 | AC | 66 ms
68,256 KB |
testcase_11 | AC | 411 ms
103,364 KB |
testcase_12 | AC | 394 ms
102,644 KB |
testcase_13 | WA | - |
testcase_14 | AC | 444 ms
96,744 KB |
testcase_15 | AC | 372 ms
99,800 KB |
testcase_16 | AC | 432 ms
96,876 KB |
testcase_17 | AC | 447 ms
97,008 KB |
testcase_18 | WA | - |
testcase_19 | AC | 407 ms
96,748 KB |
testcase_20 | WA | - |
testcase_21 | AC | 332 ms
97,328 KB |
testcase_22 | AC | 418 ms
103,676 KB |
testcase_23 | AC | 498 ms
99,608 KB |
testcase_24 | AC | 423 ms
103,672 KB |
testcase_25 | AC | 36 ms
53,460 KB |
testcase_26 | AC | 36 ms
53,460 KB |
testcase_27 | AC | 477 ms
102,792 KB |
testcase_28 | AC | 553 ms
102,704 KB |
ソースコード
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] if hmod==0 or wmod==0: if hmod==0: wm = w%wmod print(bl(rS,wm)) else: hm = h%hmod print(bl(dS,hm)) else: 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)