結果
| 問題 |
No.1650 Moving Coins
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-07-14 15:33:36 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 292 ms / 2,000 ms |
| コード長 | 715 bytes |
| コンパイル時間 | 452 ms |
| コンパイル使用メモリ | 82,168 KB |
| 実行使用メモリ | 136,204 KB |
| 最終ジャッジ日時 | 2024-07-14 15:33:47 |
| 合計ジャッジ時間 | 10,887 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
# import pypyjit
# pypyjit.set_param("max_unroll_recursion=-1")
from collections import *
from functools import *
from itertools import *
from heapq import *
import sys, math
# sys.setrecursionlimit(10**4)
# input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
R = deque()
L = deque()
I = [0]*N
for i,(a,b) in enumerate(zip(A,B)):
if a<b:
R.append(i)
I[i] = 1
else:
L.append(i)
X = []
while R:
x = R.pop()
d = B[x]-A[x]
for _ in range(d):
X.append((x+1,'R'))
while L:
x = L.popleft()
d = A[x]-B[x]
for _ in range(d):
X.append((x+1,'L'))
print(len(X))
for x,y in X:
print(x,y)