結果

問題 No.1650 Moving Coins
ユーザー tcltktcltk
提出日時 2021-10-17 05:54:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 349 ms / 2,000 ms
コード長 787 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 81,676 KB
実行使用メモリ 151,552 KB
最終ジャッジ日時 2023-10-17 22:23:17
合計ジャッジ時間 14,653 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
85,856 KB
testcase_01 AC 126 ms
85,856 KB
testcase_02 AC 127 ms
85,860 KB
testcase_03 AC 239 ms
113,432 KB
testcase_04 AC 239 ms
109,276 KB
testcase_05 AC 245 ms
108,488 KB
testcase_06 AC 265 ms
114,296 KB
testcase_07 AC 261 ms
112,972 KB
testcase_08 AC 274 ms
126,984 KB
testcase_09 AC 281 ms
119,068 KB
testcase_10 AC 277 ms
124,612 KB
testcase_11 AC 316 ms
120,656 KB
testcase_12 AC 292 ms
112,396 KB
testcase_13 AC 297 ms
111,760 KB
testcase_14 AC 307 ms
118,008 KB
testcase_15 AC 274 ms
115,372 KB
testcase_16 AC 308 ms
124,880 KB
testcase_17 AC 302 ms
124,872 KB
testcase_18 AC 319 ms
130,160 KB
testcase_19 AC 330 ms
151,552 KB
testcase_20 AC 316 ms
142,212 KB
testcase_21 AC 349 ms
144,724 KB
testcase_22 AC 319 ms
141,944 KB
testcase_23 AC 318 ms
141,952 KB
testcase_24 AC 250 ms
124,852 KB
testcase_25 AC 234 ms
109,804 KB
testcase_26 AC 210 ms
141,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """2
# 1 2
# 2 4
# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**10

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

wait = False
q = []
result = []
for i in range(N):
    if A[i] < B[i]:
        for _ in range(B[i]-A[i]):
            q.append((i+1, 'R'))
    else:
        while q:
            result.append(q.pop())
        for _ in range(A[i]-B[i]):
            result.append((i+1, 'L'))
while q:
    result.append(q.pop())

print(len(result))
for i, c in result:
    print(i, c)


0