結果

問題 No.1650 Moving Coins
ユーザー kohei2019
提出日時 2022-06-28 23:16:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 270,272 KB
最終ジャッジ日時 2024-11-21 18:18:53
合計ジャッジ時間 10,171 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
N = int(input())
lsA = list(map(int,input().split()))
lsB = list(map(int,input().split()))

moves = []
def moveto(n,k):
    if lsA[n] == k:
        return
    if n == N-1:
        moves.append((n,'R'))
        lsA[n] += 1

    else:
        if lsA[n]+1 == lsA[n+1]:
            moveto(n+1,lsA[n+1]+1)
            moves.append((n,'R'))
            lsA[n] += 1
        else:
            moves.append((n,'R'))
            lsA[n] += 1


for i in range(N):
    move = lsB[i]-lsA[i]
    now = lsA[i]
    if move <= 0:
        while move != 0:
            moves.append((i,'L'))
            move += 1
    else:
        stac = []
        moveto(i,lsB[i])

print(len(moves))
for a,b in moves:
    print(a+1,b)
0