結果

問題 No.1650 Moving Coins
ユーザー kohei2019kohei2019
提出日時 2022-06-28 23:16:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 739 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 270,596 KB
最終ジャッジ日時 2024-05-01 13:36:28
合計ジャッジ時間 10,408 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,968 KB
testcase_01 AC 38 ms
52,224 KB
testcase_02 AC 36 ms
51,712 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 172 ms
111,360 KB
testcase_09 WA -
testcase_10 AC 177 ms
111,644 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 535 ms
270,596 KB
testcase_20 AC 208 ms
132,844 KB
testcase_21 AC 382 ms
188,588 KB
testcase_22 AC 209 ms
131,832 KB
testcase_23 AC 212 ms
132,144 KB
testcase_24 WA -
testcase_25 AC 146 ms
97,152 KB
testcase_26 AC 111 ms
108,504 KB
権限があれば一括ダウンロードができます

ソースコード

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