結果

問題 No.1650 Moving Coins
ユーザー huka_hukahuka_huka
提出日時 2021-08-22 08:01:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 345 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 139,368 KB
最終ジャッジ日時 2024-04-23 21:27:14
合計ジャッジ時間 7,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,840 KB
testcase_01 AC 40 ms
51,840 KB
testcase_02 AC 38 ms
51,968 KB
testcase_03 AC 97 ms
95,104 KB
testcase_04 AC 87 ms
89,868 KB
testcase_05 AC 90 ms
93,184 KB
testcase_06 AC 95 ms
95,488 KB
testcase_07 AC 95 ms
95,360 KB
testcase_08 AC 151 ms
113,392 KB
testcase_09 AC 143 ms
103,936 KB
testcase_10 AC 150 ms
114,948 KB
testcase_11 AC 154 ms
109,184 KB
testcase_12 AC 131 ms
99,132 KB
testcase_13 AC 128 ms
100,212 KB
testcase_14 AC 145 ms
103,404 KB
testcase_15 AC 122 ms
97,920 KB
testcase_16 AC 164 ms
111,584 KB
testcase_17 AC 160 ms
110,844 KB
testcase_18 AC 170 ms
114,856 KB
testcase_19 AC 180 ms
139,368 KB
testcase_20 AC 177 ms
135,736 KB
testcase_21 AC 188 ms
132,276 KB
testcase_22 AC 184 ms
132,676 KB
testcase_23 AC 183 ms
132,036 KB
testcase_24 AC 83 ms
89,472 KB
testcase_25 AC 96 ms
95,616 KB
testcase_26 AC 120 ms
108,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# yc1650
n = int(input())
a = list(map(int, input().split()))

b = list(map(int, input().split()))
lq = []
rq = []
for i in range(n):
    if a[i] < b[i]:
        rq.append(i)
    elif a[i] > b[i]:
        lq.append(i)
m = 0
ans = []
for i in rq[::-1]:
    m += b[i]-a[i]
    for _ in range(b[i]-a[i]):
        ans.append(str(i+1)+" R")
for i in lq:
    m += a[i]-b[i]
    for _ in range(a[i]-b[i]):
        ans.append(str(i+1)+" L")
print(m)
for i in ans:
    print(i)
0