結果

問題 No.1650 Moving Coins
ユーザー judgelawjudgelaw
提出日時 2021-08-20 21:49:46
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 549 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 746 ms
コンパイル使用メモリ 10,828 KB
実行使用メモリ 47,072 KB
最終ジャッジ日時 2023-08-04 06:10:50
合計ジャッジ時間 12,997 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,840 KB
testcase_01 AC 16 ms
7,820 KB
testcase_02 AC 16 ms
7,796 KB
testcase_03 AC 191 ms
8,436 KB
testcase_04 AC 147 ms
8,296 KB
testcase_05 AC 175 ms
8,364 KB
testcase_06 AC 191 ms
8,396 KB
testcase_07 AC 195 ms
8,340 KB
testcase_08 AC 366 ms
28,672 KB
testcase_09 AC 364 ms
27,800 KB
testcase_10 AC 384 ms
28,652 KB
testcase_11 AC 387 ms
29,484 KB
testcase_12 AC 299 ms
19,808 KB
testcase_13 AC 304 ms
20,048 KB
testcase_14 AC 367 ms
26,716 KB
testcase_15 AC 273 ms
17,284 KB
testcase_16 AC 418 ms
31,548 KB
testcase_17 AC 400 ms
31,744 KB
testcase_18 AC 441 ms
35,500 KB
testcase_19 AC 535 ms
47,072 KB
testcase_20 AC 535 ms
45,496 KB
testcase_21 AC 542 ms
45,464 KB
testcase_22 AC 540 ms
45,276 KB
testcase_23 AC 549 ms
45,308 KB
testcase_24 AC 196 ms
8,308 KB
testcase_25 AC 196 ms
8,452 KB
testcase_26 AC 336 ms
45,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
ans=0
handL=[]
handR=[]
for i in range(N):
    temp=abs(A[i]-B[i])
    ans+=temp
    if A[i]>B[i]:
        handL.append((i+1,"L",temp))
    else:
        handR.append((i+1,"R",temp))

handR=handR[::-1]

print(ans)
for i,w,cnt in handL:
    for _ in range(cnt):
        print(i,w)

for i,w,cnt in handR:
    for _ in range(cnt):
        print(i,w)
0