結果
| 問題 |
No.1650 Moving Coins
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-29 12:48:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 511 bytes |
| コンパイル時間 | 356 ms |
| コンパイル使用メモリ | 82,132 KB |
| 実行使用メモリ | 110,756 KB |
| 最終ジャッジ日時 | 2024-07-16 09:36:18 |
| 合計ジャッジ時間 | 11,123 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 11 |
ソースコード
from bisect import *
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
res=0
res2=[]
for i in range(N):
a,b=A[i],B[i]
j=bisect_left(A,b+1)-1
cnt=j-i
if cnt>=0:
for k in range(i,j+1)[::-1]:
new_a=b+cnt
res+=new_a-A[k]
res2.extend([(k+1,"R")]*(new_a-A[k]))
A[k]=new_a
cnt-=1
else:
res2.extend([(i+1,"L")]*(A[i]-B[i]))
res+=A[i]-B[i]
print(res)
for k,c in res2:
print(k,c)