結果

問題 No.1650 Moving Coins
ユーザー ayaoniayaoni
提出日時 2021-08-20 22:59:43
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,035 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 732,016 KB
最終ジャッジ日時 2024-04-22 06:55:15
合計ジャッジ時間 10,617 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
65,664 KB
testcase_01 AC 42 ms
59,776 KB
testcase_02 AC 41 ms
60,032 KB
testcase_03 AC 175 ms
101,120 KB
testcase_04 AC 165 ms
97,792 KB
testcase_05 AC 199 ms
103,008 KB
testcase_06 AC 199 ms
100,096 KB
testcase_07 AC 187 ms
101,504 KB
testcase_08 AC 200 ms
119,200 KB
testcase_09 AC 252 ms
113,180 KB
testcase_10 AC 202 ms
119,380 KB
testcase_11 AC 276 ms
106,956 KB
testcase_12 AC 262 ms
102,272 KB
testcase_13 AC 257 ms
103,040 KB
testcase_14 AC 297 ms
113,024 KB
testcase_15 AC 260 ms
103,424 KB
testcase_16 AC 302 ms
114,944 KB
testcase_17 AC 284 ms
113,152 KB
testcase_18 AC 272 ms
113,168 KB
testcase_19 MLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())


N = I()
A = LI()
B = LI()
flag = [0]*(10**6+1)
for a in A:
    flag[a] += 1


def right(x,i):  # xにあるコインを1つ右に
    res = []
    if flag[x+1]:
        res += right(x+1,i+1)
    flag[x] = 0
    flag[x+1] = 1
    res.append((i,'R'))
    A[i-1] += 1
    return res


ANS = []
for i in range(N):
    a = A[i]
    b = B[i]
    if a >= b:
        for _ in range(a-b):
            ANS.append((i+1,'L'))
    else:
        for j in range(a,b):
            X = right(j,i+1)
            for x in X:
                ANS.append(x)

print(len(ANS))
for k,c in ANS:
    print(k,c)
0