結果
問題 | No.2716 Falcon Method |
ユーザー | ニックネーム |
提出日時 | 2024-04-05 22:03:15 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 378 ms |
コンパイル使用メモリ | 11,904 KB |
実行使用メモリ | 29,696 KB |
最終ジャッジ日時 | 2024-04-05 22:03:34 |
合計ジャッジ時間 | 18,349 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 31 ms
10,112 KB |
testcase_01 | RE | - |
testcase_02 | AC | 31 ms
10,112 KB |
testcase_03 | AC | 30 ms
10,112 KB |
testcase_04 | AC | 30 ms
10,112 KB |
testcase_05 | AC | 29 ms
10,112 KB |
testcase_06 | RE | - |
testcase_07 | AC | 39 ms
10,240 KB |
testcase_08 | AC | 39 ms
10,240 KB |
testcase_09 | AC | 49 ms
10,240 KB |
testcase_10 | AC | 38 ms
10,240 KB |
testcase_11 | RE | - |
testcase_12 | AC | 970 ms
28,920 KB |
testcase_13 | AC | 773 ms
28,956 KB |
testcase_14 | AC | 1,115 ms
25,856 KB |
testcase_15 | AC | 857 ms
27,984 KB |
testcase_16 | AC | 990 ms
25,984 KB |
testcase_17 | AC | 1,097 ms
26,604 KB |
testcase_18 | AC | 1,338 ms
27,248 KB |
testcase_19 | AC | 1,002 ms
25,572 KB |
testcase_20 | AC | 833 ms
27,724 KB |
testcase_21 | AC | 959 ms
26,348 KB |
testcase_22 | RE | - |
testcase_23 | AC | 1,395 ms
29,696 KB |
testcase_24 | AC | 1,233 ms
29,696 KB |
testcase_25 | AC | 30 ms
10,112 KB |
testcase_26 | RE | - |
testcase_27 | AC | 1,373 ms
29,696 KB |
testcase_28 | AC | 1,382 ms
29,696 KB |
ソースコード
from bisect import bisect_left n,q = map(int,input().split()) s = input()*2; d = [0]; r = [0] for v in s: d.append(d[-1]); r.append(r[-1]) if v=="D": d[-1] += 1 else: r[-1] += 1 for _ in range(q): h,w,p = map(int,input().split()) if d[n]: d1,d2 = divmod(h,d[n]) else: d1 = d2 = n if d1>0==d2: d1 -= 1; d2 += d[n] d3 = max(bisect_left(d,d[p]+d2),p) if r[n]: r1,r2 = divmod(w,r[n]) else: d1 = d2 = n if r1>0==r2: r1 -= 1; r2 += r[n] r3 = max(bisect_left(r,r[p]+r2),p) print(d3%n if (d1,d3)<(r1,r3) else r3%n)