結果
| 問題 |
No.1650 Moving Coins
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-12-25 13:42:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 188 ms / 2,000 ms |
| コード長 | 453 bytes |
| コンパイル時間 | 178 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 129,828 KB |
| 最終ジャッジ日時 | 2024-09-21 15:57:50 |
| 合計ジャッジ時間 | 8,424 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
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')