結果

問題 No.1650 Moving Coins
ユーザー irumo8202irumo8202
提出日時 2022-02-07 10:59:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 134,876 KB
最終ジャッジ日時 2023-09-02 19:08:52
合計ジャッジ時間 15,541 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 72 ms
71,252 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
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 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 147 ms
110,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split())) + [10 ** 9]
B = list(map(int, input().split()))


stack = []
ans = []
for i in range(N):
    now_pos = A[i]
    to_pos = B[i]
    move = abs(now_pos - to_pos)
    if A[i + 1] > to_pos:
        if now_pos < to_pos:
            direction = "R"
        else:
            direction = "L"
        for _ in range(move):
            ans.append((i + 1, direction))

        while stack:
            ind, move = stack.pop()
            for _ in range(move):
                ans.append((ind + 1, "R"))
    else:
        stack.append((i, move))

if ans:
    for row in ans:
        print(*row)
else:
    print(0)
0