結果

問題 No.1650 Moving Coins
コンテスト
ユーザー O2MT
提出日時 2021-08-21 01:51:35
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 202 ms / 2,000 ms
+ 597µs
コード長 499 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 74 ms
コンパイル使用メモリ 80,896 KB
実行使用メモリ 164,528 KB
最終ジャッジ日時 2026-09-16 12:44:06
合計ジャッジ時間 8,028 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import deque

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort()
B.sort()
l = []

for i in range(N):
  l.append((A[i],B[i],i+1))

ans_list = []
que = deque([])

for i in range(N):
  a,b,n = l[i]
  if a < b:
    que.appendleft((a,b,n))
  else:
    for _ in range(abs(a-b)):
      ans_list.append((n,'L'))

for a,b,n in que:
  for _ in range(abs(a-b)):
      ans_list.append((n,'R'))

print(len(ans_list))
for a,b in ans_list:
  print(a,b)
0