結果

問題 No.1650 Moving Coins
ユーザー titiatitia
提出日時 2021-08-20 21:46:15
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 520 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 120,932 KB
最終ジャッジ日時 2024-04-22 04:11:13
合計ジャッジ時間 9,667 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,728 KB
testcase_01 AC 36 ms
51,840 KB
testcase_02 AC 38 ms
51,840 KB
testcase_03 AC 145 ms
98,672 KB
testcase_04 AC 154 ms
92,364 KB
testcase_05 AC 176 ms
96,256 KB
testcase_06 AC 178 ms
98,816 KB
testcase_07 AC 172 ms
98,944 KB
testcase_08 AC 195 ms
111,076 KB
testcase_09 AC 242 ms
102,144 KB
testcase_10 AC 199 ms
111,800 KB
testcase_11 AC 317 ms
111,444 KB
testcase_12 AC 277 ms
99,372 KB
testcase_13 AC 284 ms
99,704 KB
testcase_14 AC 340 ms
102,144 KB
testcase_15 AC 185 ms
100,076 KB
testcase_16 AC 235 ms
115,172 KB
testcase_17 AC 219 ms
114,632 KB
testcase_18 AC 230 ms
120,932 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()))

ANS=[]
while A!=B:
    for i in range(N):
        if A[i]<B[i]:
            while A[i]<B[i] and (i+1==N or A[i+1]!=A[i]+1):
                ANS.append((i+1,"R"))
                A[i]+=1
        elif A[i]>B[i]:
            while A[i]>B[i] and (i==0 or A[i-1]!=A[i]-1):
                ANS.append((i+1,"L"))
                A[i]-=1
                
    
print(len(ANS))
for x,y in ANS:
    print(x,y)
0