結果

問題 No.1650 Moving Coins
ユーザー hir355hir355
提出日時 2021-08-20 21:48:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 655 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,356 KB
実行使用メモリ 142,508 KB
最終ジャッジ日時 2024-04-22 04:13:46
合計ジャッジ時間 8,837 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,840 KB
testcase_01 AC 37 ms
51,968 KB
testcase_02 AC 36 ms
51,968 KB
testcase_03 AC 140 ms
98,688 KB
testcase_04 AC 122 ms
91,904 KB
testcase_05 AC 137 ms
96,256 KB
testcase_06 AC 142 ms
98,944 KB
testcase_07 AC 143 ms
99,200 KB
testcase_08 AC 187 ms
112,036 KB
testcase_09 AC 186 ms
104,448 KB
testcase_10 AC 189 ms
112,704 KB
testcase_11 AC 200 ms
104,092 KB
testcase_12 AC 174 ms
100,908 KB
testcase_13 AC 173 ms
100,680 KB
testcase_14 AC 194 ms
103,936 KB
testcase_15 AC 172 ms
100,864 KB
testcase_16 AC 211 ms
104,876 KB
testcase_17 AC 206 ms
106,080 KB
testcase_18 AC 225 ms
107,732 KB
testcase_19 AC 219 ms
134,540 KB
testcase_20 AC 217 ms
134,564 KB
testcase_21 AC 223 ms
134,568 KB
testcase_22 AC 228 ms
142,508 KB
testcase_23 AC 224 ms
142,248 KB
testcase_24 AC 141 ms
98,688 KB
testcase_25 AC 149 ms
99,072 KB
testcase_26 AC 130 ms
110,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
idx = n
l = [0] * n
for i in range(n):
    if a[i] < b[i]:
        l[i] = 1
x = [0]
if l[0] == 1:
    x.append(0)
for i in range(n - 1):
    if l[i] != l[i + 1]:
        x.append(i + 1)
x.append(n)
ans = []
for i in range(len(x) - 1):
    if i % 2 == 0:
        for j in range(x[i], x[i + 1]):
            for k in range(a[j] - b[j]):
               ans.append((j + 1, 'L'))
    else:
        for j in range(x[i + 1] - 1, x[i] - 1, -1):
            for k in range(b[j] - a[j]):
                ans.append((j + 1, 'R'))
print(len(ans))
for row in ans:
    print(*row)
0