結果

問題 No.1650 Moving Coins
ユーザー kohei2019kohei2019
提出日時 2022-06-28 23:21:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 701 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 81,936 KB
実行使用メモリ 320,960 KB
最終ジャッジ日時 2024-05-01 13:44:39
合計ジャッジ時間 10,634 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,208 KB
testcase_01 AC 36 ms
52,240 KB
testcase_02 AC 36 ms
52,884 KB
testcase_03 AC 176 ms
92,004 KB
testcase_04 AC 151 ms
91,228 KB
testcase_05 AC 188 ms
93,784 KB
testcase_06 AC 193 ms
89,744 KB
testcase_07 AC 181 ms
91,260 KB
testcase_08 AC 172 ms
111,680 KB
testcase_09 AC 224 ms
105,156 KB
testcase_10 AC 174 ms
111,564 KB
testcase_11 AC 250 ms
105,988 KB
testcase_12 AC 229 ms
93,132 KB
testcase_13 AC 224 ms
93,720 KB
testcase_14 AC 292 ms
105,680 KB
testcase_15 AC 271 ms
95,448 KB
testcase_16 AC 288 ms
106,944 KB
testcase_17 AC 295 ms
105,444 KB
testcase_18 AC 332 ms
105,372 KB
testcase_19 AC 701 ms
320,960 KB
testcase_20 AC 215 ms
132,580 KB
testcase_21 AC 465 ms
220,796 KB
testcase_22 AC 221 ms
111,848 KB
testcase_23 AC 224 ms
111,588 KB
testcase_24 AC 139 ms
95,740 KB
testcase_25 AC 165 ms
97,524 KB
testcase_26 AC 114 ms
108,640 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:
        while lsA[n] != k:
            moves.append((n,'R'))
            lsA[n] += 1

    else:
        while lsA[n] != k:
            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