結果
問題 | No.2716 Falcon Method |
ユーザー | nikoro256 |
提出日時 | 2024-04-05 22:12:56 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 718 bytes |
コンパイル時間 | 193 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 85,264 KB |
最終ジャッジ日時 | 2024-04-05 22:13:05 |
合計ジャッジ時間 | 8,154 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
53,460 KB |
testcase_01 | RE | - |
testcase_02 | WA | - |
testcase_03 | AC | 39 ms
53,460 KB |
testcase_04 | AC | 37 ms
53,460 KB |
testcase_05 | RE | - |
testcase_06 | RE | - |
testcase_07 | WA | - |
testcase_08 | AC | 71 ms
70,580 KB |
testcase_09 | WA | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | AC | 415 ms
84,776 KB |
testcase_13 | WA | - |
testcase_14 | AC | 489 ms
83,284 KB |
testcase_15 | AC | 367 ms
84,452 KB |
testcase_16 | AC | 419 ms
83,316 KB |
testcase_17 | AC | 485 ms
83,676 KB |
testcase_18 | WA | - |
testcase_19 | AC | 444 ms
83,152 KB |
testcase_20 | WA | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | AC | 536 ms
85,264 KB |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | AC | 507 ms
85,252 KB |
testcase_28 | AC | 535 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-1-bisect.bisect_left(dat,dat[-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) r=solve(rs,rss[P-1]+W) l=solve(ls,lss[P-1]+H) #print(r,l) if r>l: print(l%N) else: print(r%N)