結果

問題 No.1650 Moving Coins
ユーザー ああいいああいい
提出日時 2022-04-27 10:24:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 497 bytes
コンパイル時間 525 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 133,732 KB
最終ジャッジ日時 2023-09-10 16:32:54
合計ジャッジ時間 10,369 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,300 KB
testcase_01 AC 75 ms
71,300 KB
testcase_02 AC 73 ms
71,300 KB
testcase_03 AC 180 ms
99,572 KB
testcase_04 AC 178 ms
93,200 KB
testcase_05 AC 200 ms
97,400 KB
testcase_06 AC 210 ms
99,856 KB
testcase_07 AC 201 ms
99,636 KB
testcase_08 AC 230 ms
114,312 KB
testcase_09 AC 232 ms
111,552 KB
testcase_10 AC 236 ms
115,084 KB
testcase_11 AC 260 ms
104,104 KB
testcase_12 AC 238 ms
101,264 KB
testcase_13 AC 237 ms
101,552 KB
testcase_14 AC 253 ms
110,852 KB
testcase_15 AC 208 ms
101,548 KB
testcase_16 AC 254 ms
107,324 KB
testcase_17 AC 241 ms
105,244 KB
testcase_18 AC 261 ms
108,300 KB
testcase_19 AC 258 ms
128,712 KB
testcase_20 AC 258 ms
133,732 KB
testcase_21 AC 276 ms
122,984 KB
testcase_22 AC 257 ms
128,228 KB
testcase_23 AC 256 ms
128,268 KB
testcase_24 AC 172 ms
99,788 KB
testcase_25 AC 191 ms
99,572 KB
testcase_26 AC 150 ms
109,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = []
left = 0
while left < N:
    right = left
    while right < N and A[right] < B[right]:
        right += 1
    for i in reversed(range(left,right)):
        for j in range(A[i],B[i]):
            ans.append((i + 1,"R"))
    if right < N:
        for j in range(A[right],B[right],-1):
            ans.append((right + 1,"L"))
    left = right + 1
print(len(ans))
for k,c in ans:
    print(k,c)

        
0