結果

問題 No.1650 Moving Coins
ユーザー wolgnikwolgnik
提出日時 2021-08-20 21:49:55
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 514 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 270,632 KB
最終ジャッジ日時 2024-04-22 04:18:03
合計ジャッジ時間 10,360 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
60,232 KB
testcase_01 AC 36 ms
52,572 KB
testcase_02 AC 37 ms
52,624 KB
testcase_03 AC 157 ms
93,264 KB
testcase_04 AC 146 ms
87,456 KB
testcase_05 AC 152 ms
91,680 KB
testcase_06 AC 168 ms
91,332 KB
testcase_07 AC 163 ms
91,260 KB
testcase_08 AC 230 ms
145,448 KB
testcase_09 AC 353 ms
247,960 KB
testcase_10 AC 238 ms
144,564 KB
testcase_11 AC 332 ms
196,880 KB
testcase_12 AC 322 ms
244,760 KB
testcase_13 AC 317 ms
224,568 KB
testcase_14 AC 314 ms
219,020 KB
testcase_15 AC 221 ms
126,580 KB
testcase_16 AC 258 ms
138,272 KB
testcase_17 AC 256 ms
136,392 KB
testcase_18 AC 267 ms
137,036 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

res = []
s = {i for i in range(N)}
while len(s):
  t = set(s)
  for i in t:
    if a[i] < b[i]:
      if i + 1 < N and a[i + 1] == a[i] + 1: continue
      res.append((i + 1, "R"))
      a[i] += 1
    elif a[i] > b[i]:
      if i and a[i - 1] == a[i] + 1: continue
      res.append((i + 1, "L"))
      a[i] -= 1
    if a[i] == b[i]: s.discard(i)

print(len(res))
for r in res: print(*r)
0