結果

問題 No.1650 Moving Coins
ユーザー lloyzlloyz
提出日時 2021-12-20 22:49:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 521 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 10,724 KB
実行使用メモリ 47,304 KB
最終ジャッジ日時 2023-10-13 19:36:31
合計ジャッジ時間 13,378 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,460 KB
testcase_01 AC 18 ms
8,388 KB
testcase_02 AC 18 ms
8,416 KB
testcase_03 AC 253 ms
22,212 KB
testcase_04 AC 196 ms
18,796 KB
testcase_05 AC 231 ms
21,100 KB
testcase_06 AC 256 ms
22,396 KB
testcase_07 AC 259 ms
22,672 KB
testcase_08 AC 389 ms
36,368 KB
testcase_09 AC 379 ms
37,188 KB
testcase_10 AC 391 ms
37,284 KB
testcase_11 AC 400 ms
37,788 KB
testcase_12 AC 342 ms
33,624 KB
testcase_13 AC 344 ms
33,988 KB
testcase_14 AC 391 ms
36,500 KB
testcase_15 AC 328 ms
32,708 KB
testcase_16 AC 413 ms
38,388 KB
testcase_17 AC 407 ms
37,292 KB
testcase_18 AC 438 ms
39,828 KB
testcase_19 AC 497 ms
44,484 KB
testcase_20 AC 516 ms
45,496 KB
testcase_21 AC 516 ms
45,328 KB
testcase_22 AC 521 ms
47,304 KB
testcase_23 AC 514 ms
47,152 KB
testcase_24 AC 257 ms
22,880 KB
testcase_25 AC 259 ms
22,840 KB
testcase_26 AC 180 ms
40,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

ANS = deque()
for i in range(n):
    if A[i] < B[i]:
        cnt = B[i] - A[i]
        for j in range(cnt):
            ANS.appendleft((i + 1, 'R'))
    elif A[i] > B[i]:
        cnt = A[i] - B[i]
        for j in range(cnt):
            ANS.append((i + 1, 'L'))

print(len(ANS))
for ind, direction in ANS:
    print(ind, direction)
0