結果

問題 No.1650 Moving Coins
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-08-20 21:53:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 630 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 82,712 KB
実行使用メモリ 123,872 KB
最終ジャッジ日時 2024-04-22 04:23:48
合計ジャッジ時間 10,279 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
60,196 KB
testcase_01 AC 37 ms
52,760 KB
testcase_02 AC 39 ms
52,888 KB
testcase_03 AC 180 ms
100,416 KB
testcase_04 AC 152 ms
98,044 KB
testcase_05 AC 169 ms
100,684 KB
testcase_06 AC 185 ms
102,308 KB
testcase_07 AC 184 ms
100,988 KB
testcase_08 AC 217 ms
110,680 KB
testcase_09 AC 279 ms
106,856 KB
testcase_10 AC 225 ms
110,968 KB
testcase_11 AC 330 ms
106,068 KB
testcase_12 AC 292 ms
110,508 KB
testcase_13 AC 297 ms
106,656 KB
testcase_14 AC 357 ms
103,664 KB
testcase_15 AC 219 ms
109,908 KB
testcase_16 AC 242 ms
109,360 KB
testcase_17 AC 245 ms
109,916 KB
testcase_18 AC 262 ms
114,228 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

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