結果

問題 No.1650 Moving Coins
ユーザー kozykozy
提出日時 2021-08-20 21:50:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 683 ms / 2,000 ms
コード長 521 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 84,280 KB
最終ジャッジ日時 2024-04-22 04:19:16
合計ジャッジ時間 16,037 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 374 ms
27,520 KB
testcase_04 AC 277 ms
23,296 KB
testcase_05 AC 330 ms
26,112 KB
testcase_06 AC 384 ms
27,776 KB
testcase_07 AC 380 ms
28,032 KB
testcase_08 AC 515 ms
57,128 KB
testcase_09 AC 532 ms
39,424 KB
testcase_10 AC 536 ms
58,204 KB
testcase_11 AC 549 ms
49,928 KB
testcase_12 AC 477 ms
36,440 KB
testcase_13 AC 486 ms
37,024 KB
testcase_14 AC 528 ms
46,104 KB
testcase_15 AC 462 ms
34,828 KB
testcase_16 AC 570 ms
56,016 KB
testcase_17 AC 564 ms
56,672 KB
testcase_18 AC 600 ms
58,328 KB
testcase_19 AC 676 ms
60,688 KB
testcase_20 AC 667 ms
84,280 KB
testcase_21 AC 672 ms
73,268 KB
testcase_22 AC 683 ms
82,864 KB
testcase_23 AC 682 ms
82,752 KB
testcase_24 AC 383 ms
28,032 KB
testcase_25 AC 382 ms
28,288 KB
testcase_26 AC 214 ms
59,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10000000)
def do(i):
  if i==N:
    return;
  if A[i]==B[i]:
    do(i+1)
    return;
  elif A[i]>B[i]:
    for j in range(A[i],B[i],-1):
      Q.append([i,"L"])
    do(i+1)
  else:
    flag=True
    if i!=N-1:
      if B[i]>=A[i+1]:
        do(i+1)
        flag=False
    for j in range(A[i],B[i]):
      Q.append([i,"R"])
    if flag:
      do(i+1)
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
Q=list()
do(0)
print(len(Q))
for a,b in Q:
  print(a+1,b)
0