結果
| 問題 |
No.1650 Moving Coins
|
| コンテスト | |
| ユーザー |
wolgnik
|
| 提出日時 | 2021-08-20 21:49:55 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 514 bytes |
| コンパイル時間 | 576 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 268,472 KB |
| 最終ジャッジ日時 | 2024-10-14 03:19:02 |
| 合計ジャッジ時間 | 10,433 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 TLE * 1 -- * 7 |
ソースコード
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)
wolgnik