結果

問題 No.1650 Moving Coins
ユーザー O2MTO2MT
提出日時 2021-08-21 01:51:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 294 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 151,660 KB
最終ジャッジ日時 2024-04-22 11:19:36
合計ジャッジ時間 9,207 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,504 KB
testcase_01 AC 41 ms
53,120 KB
testcase_02 AC 43 ms
53,248 KB
testcase_03 AC 169 ms
98,688 KB
testcase_04 AC 127 ms
92,288 KB
testcase_05 AC 141 ms
96,256 KB
testcase_06 AC 147 ms
98,560 KB
testcase_07 AC 155 ms
98,816 KB
testcase_08 AC 217 ms
117,728 KB
testcase_09 AC 235 ms
126,644 KB
testcase_10 AC 213 ms
118,540 KB
testcase_11 AC 225 ms
124,988 KB
testcase_12 AC 199 ms
104,744 KB
testcase_13 AC 193 ms
105,320 KB
testcase_14 AC 223 ms
120,280 KB
testcase_15 AC 190 ms
109,056 KB
testcase_16 AC 238 ms
126,980 KB
testcase_17 AC 243 ms
124,860 KB
testcase_18 AC 256 ms
128,532 KB
testcase_19 AC 279 ms
151,660 KB
testcase_20 AC 256 ms
135,804 KB
testcase_21 AC 294 ms
140,556 KB
testcase_22 AC 264 ms
138,320 KB
testcase_23 AC 269 ms
138,196 KB
testcase_24 AC 139 ms
95,872 KB
testcase_25 AC 145 ms
97,636 KB
testcase_26 AC 155 ms
125,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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