結果

問題 No.1650 Moving Coins
ユーザー NoneNone
提出日時 2021-09-29 12:48:01
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 111,916 KB
最終ジャッジ日時 2023-09-23 10:08:23
合計ジャッジ時間 15,280 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,224 KB
testcase_01 AC 71 ms
71,428 KB
testcase_02 AC 71 ms
71,412 KB
testcase_03 AC 218 ms
89,300 KB
testcase_04 AC 151 ms
82,476 KB
testcase_05 AC 192 ms
86,568 KB
testcase_06 AC 180 ms
87,840 KB
testcase_07 AC 179 ms
88,060 KB
testcase_08 AC 273 ms
100,340 KB
testcase_09 WA -
testcase_10 AC 280 ms
99,532 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 313 ms
111,916 KB
testcase_21 WA -
testcase_22 AC 332 ms
110,852 KB
testcase_23 AC 327 ms
110,900 KB
testcase_24 AC 151 ms
80,376 KB
testcase_25 AC 168 ms
81,012 KB
testcase_26 AC 218 ms
110,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0