結果

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

ソースコード

diff #

def main():
	import sys
	input = sys.stdin.buffer.readline
	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"])
			if a[i] > b[i]:
				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)
if __name__ == '__main__':
	main()
	
0