結果

問題 No.1650 Moving Coins
ユーザー ysys
提出日時 2021-12-25 13:42:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 129,344 KB
最終ジャッジ日時 2023-10-21 14:43:05
合計ジャッジ時間 9,914 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
53,552 KB
testcase_01 AC 28 ms
53,552 KB
testcase_02 AC 28 ms
53,552 KB
testcase_03 AC 62 ms
75,936 KB
testcase_04 AC 64 ms
75,916 KB
testcase_05 AC 66 ms
75,992 KB
testcase_06 AC 67 ms
75,992 KB
testcase_07 AC 72 ms
76,008 KB
testcase_08 AC 117 ms
103,024 KB
testcase_09 AC 109 ms
103,076 KB
testcase_10 AC 123 ms
103,372 KB
testcase_11 AC 137 ms
103,408 KB
testcase_12 AC 104 ms
91,592 KB
testcase_13 AC 109 ms
91,640 KB
testcase_14 AC 125 ms
103,184 KB
testcase_15 AC 97 ms
90,096 KB
testcase_16 AC 140 ms
104,624 KB
testcase_17 AC 141 ms
104,420 KB
testcase_18 AC 150 ms
111,104 KB
testcase_19 AC 146 ms
129,344 KB
testcase_20 AC 151 ms
128,040 KB
testcase_21 AC 154 ms
127,688 KB
testcase_22 AC 148 ms
126,732 KB
testcase_23 AC 149 ms
126,744 KB
testcase_24 AC 52 ms
75,544 KB
testcase_25 AC 61 ms
75,864 KB
testcase_26 AC 113 ms
123,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
desc = []
asc = []
ans = 0
for i in range(N):
  if A[i] <= B[i]:
    asc.append((i + 1, abs(A[i] - B[i])))
  else:
    desc.append((i + 1, abs(A[i] - B[i])))
  ans += abs(A[i] - B[i])

asc = asc[::-1]
print(ans)
for index, cnt in asc:
  for j in range(cnt):
    print(str(index) + ' R')

for index, cnt in desc:
  for j in range(cnt):
    print(str(index) + ' L')
0