結果

問題 No.1650 Moving Coins
ユーザー NatsubiSogan
提出日時 2021-08-20 21:49:10
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 500 bytes
コンパイル時間 379 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 121,464 KB
最終ジャッジ日時 2024-10-14 03:16:05
合計ジャッジ時間 10,268 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = []
cnt = 0
while True:
	if a == b: break
	for i in range(n):
		if a[i] == b[i]: continue
		if a[i] < b[i]:
			while a[i] < b[i]:
				if i < n - 1 and a[i] + 1 == a[i + 1]: break
				a[i] += 1
				cnt += 1
				ans.append([i + 1, "R"])
		else:
			while a[i] > b[i]:
				if i > 0 and a[i] - 1 == a[i - 1]: break
				a[i] -= 1
				cnt += 1
				ans.append([i + 1, "L"])
print(len(ans))
for i in ans:
	print(*i)
0