結果
問題 | No.1650 Moving Coins |
ユーザー |
![]() |
提出日時 | 2021-08-20 22:59:43 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,035 bytes |
コンパイル時間 | 192 ms |
コンパイル使用メモリ | 82,788 KB |
実行使用メモリ | 732,320 KB |
最終ジャッジ日時 | 2024-10-14 06:08:38 |
合計ジャッジ時間 | 10,203 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 MLE * 1 -- * 7 |
ソースコード
import syssys.setrecursionlimit(10**7)def I(): return int(sys.stdin.readline().rstrip())def MI(): return map(int,sys.stdin.readline().rstrip().split())def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))def LI2(): return list(map(int,sys.stdin.readline().rstrip()))def S(): return sys.stdin.readline().rstrip()def LS(): return list(sys.stdin.readline().rstrip().split())def LS2(): return list(sys.stdin.readline().rstrip())N = I()A = LI()B = LI()flag = [0]*(10**6+1)for a in A:flag[a] += 1def right(x,i): # xにあるコインを1つ右にres = []if flag[x+1]:res += right(x+1,i+1)flag[x] = 0flag[x+1] = 1res.append((i,'R'))A[i-1] += 1return resANS = []for i in range(N):a = A[i]b = B[i]if a >= b:for _ in range(a-b):ANS.append((i+1,'L'))else:for j in range(a,b):X = right(j,i+1)for x in X:ANS.append(x)print(len(ANS))for k,c in ANS:print(k,c)