結果
| 問題 |
No.1650 Moving Coins
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2021-07-17 20:23:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 710 bytes |
| コンパイル時間 | 166 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 148,224 KB |
| 最終ジャッジ日時 | 2024-10-14 02:17:47 |
| 合計ジャッジ時間 | 8,799 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 18 |
ソースコード
N=int(input())
A=["*"]+list(map(int,input().split()))+[10**8]
B=["*"]+list(map(int,input().split()))+[10**8]
D=[0]*(N+2)
for i in range(1,N+1):
if A[i]<B[i]:
D[i]=1
elif A[i]>B[i]:
D[i]=-1
X=[]
Y=[]
a=D[1]
for i in range(1,N+2):
if D[i]!=a:
X.append(Y)
Y=[]
Y.append(i)
X.append(Y)
Command=[]
for y in X:
if D[y[0]]==1:
for z in y[::-1]:
while A[z]<B[z]:
Command.append((z,"R"))
A[z]+=1
elif D[y[0]]==-1:
for z in y:
while A[z]>B[z]:
Command.append((z,"L"))
A[z]-=1
else:
continue
print(len(Command))
for c in Command:
print(*c)
Kazun