結果

問題 No.1650 Moving Coins
ユーザー playerplayer
提出日時 2024-01-16 23:24:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 288 ms / 2,000 ms
コード長 588 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 134,616 KB
最終ジャッジ日時 2024-01-16 23:24:20
合計ジャッジ時間 9,577 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 166 ms
100,884 KB
testcase_04 AC 146 ms
98,880 KB
testcase_05 AC 162 ms
100,672 KB
testcase_06 AC 178 ms
100,764 KB
testcase_07 AC 170 ms
100,804 KB
testcase_08 AC 255 ms
119,220 KB
testcase_09 AC 222 ms
114,480 KB
testcase_10 AC 225 ms
120,648 KB
testcase_11 AC 237 ms
122,024 KB
testcase_12 AC 218 ms
109,220 KB
testcase_13 AC 203 ms
109,404 KB
testcase_14 AC 224 ms
114,940 KB
testcase_15 AC 199 ms
108,956 KB
testcase_16 AC 242 ms
125,552 KB
testcase_17 AC 240 ms
124,332 KB
testcase_18 AC 252 ms
128,296 KB
testcase_19 AC 288 ms
133,696 KB
testcase_20 AC 267 ms
134,616 KB
testcase_21 AC 267 ms
129,752 KB
testcase_22 AC 276 ms
129,636 KB
testcase_23 AC 271 ms
129,632 KB
testcase_24 AC 168 ms
101,524 KB
testcase_25 AC 172 ms
101,024 KB
testcase_26 AC 118 ms
107,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ans = 0

if a == b:
    print(0)
    exit()
    
lism = []
lisp = []

for i in range(n):
    if a[i] == b[i]:
        continue
    if a[i] > b[i]:
        lisp.append([i+1,a[i]-b[i]])
    else:
        lism.append([i+1,b[i]-a[i]])

lism.reverse()    
ans = []
num = 0

for i,cnt in lism:
    for j in range(cnt):
        ans.append([i,"R"])
    num += cnt

for i,cnt in lisp:
    for j in range(cnt):
        ans.append([i,"L"])
    num += cnt

print(num)        
for i in ans:
    print(*i)
        
0