結果
問題 | No.2716 Falcon Method |
ユーザー | nikoro256 |
提出日時 | 2024-04-05 22:31:27 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 761 bytes |
コンパイル時間 | 165 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 85,264 KB |
最終ジャッジ日時 | 2024-04-05 22:31:36 |
合計ジャッジ時間 | 8,551 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
53,460 KB |
testcase_01 | RE | - |
testcase_02 | AC | 43 ms
53,460 KB |
testcase_03 | AC | 40 ms
53,460 KB |
testcase_04 | AC | 40 ms
53,460 KB |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | AC | 79 ms
72,660 KB |
testcase_08 | AC | 80 ms
70,572 KB |
testcase_09 | AC | 75 ms
70,572 KB |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | AC | 436 ms
84,776 KB |
testcase_13 | AC | 368 ms
84,928 KB |
testcase_14 | AC | 507 ms
83,284 KB |
testcase_15 | AC | 383 ms
84,452 KB |
testcase_16 | AC | 466 ms
83,316 KB |
testcase_17 | AC | 478 ms
83,676 KB |
testcase_18 | AC | 537 ms
84,060 KB |
testcase_19 | AC | 451 ms
83,152 KB |
testcase_20 | AC | 382 ms
84,328 KB |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 560 ms
85,264 KB |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | AC | 532 ms
85,252 KB |
testcase_28 | AC | 574 ms
85,252 KB |
ソースコード
N,Q=map(int,input().split()) S=input() rs=[0 for _ in range(N)] ls=[0 for _ in range(N)] for i in range(N): if S[i]=='R': rs[i]+=1 else: ls[i]+=1 if i!=0: rs[i]+=rs[i-1] ls[i]+=ls[i-1] import bisect def solve(dat,n): if n%dat[-1]==0: return n//dat[-1]*N-N+(bisect.bisect_left(dat,dat[-1]))+1 re=0 re+=n//dat[-1]*N #print('!',dat,n,re) re+=bisect.bisect_left(dat,n%dat[i])+1 return re rss=rs+[0] lss=ls+[0] #print(rss,lss) for _ in range(Q): H,W,P=map(int,input().split()) #print(rss[P-1]+W,lss[P-1]+H) if rs[-1]!=0: r=solve(rs,rss[P-1]+W) if ls[-1]!=0: l=solve(ls,lss[P-1]+H) #print(r,l) if r>l: print(l%N) else: print(r%N)