結果

問題 No.1650 Moving Coins
コンテスト
ユーザー NatsubiSogan
提出日時 2021-08-20 21:49:10
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 500 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 195 ms
コンパイル使用メモリ 84,864 KB
実行使用メモリ 128,640 KB
最終ジャッジ日時 2026-05-01 13:31:41
合計ジャッジ時間 10,895 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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