結果

問題 No.1650 Moving Coins
ユーザー judgelawjudgelaw
提出日時 2021-08-20 21:49:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 643 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 49,672 KB
最終ジャッジ日時 2024-04-22 04:17:42
合計ジャッジ時間 13,906 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,752 KB
testcase_01 AC 28 ms
10,752 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 235 ms
11,008 KB
testcase_04 AC 190 ms
10,880 KB
testcase_05 AC 237 ms
11,008 KB
testcase_06 AC 246 ms
10,880 KB
testcase_07 AC 248 ms
10,880 KB
testcase_08 AC 426 ms
31,332 KB
testcase_09 AC 422 ms
30,040 KB
testcase_10 AC 472 ms
31,380 KB
testcase_11 AC 458 ms
31,732 KB
testcase_12 AC 363 ms
22,360 KB
testcase_13 AC 356 ms
22,712 KB
testcase_14 AC 441 ms
29,456 KB
testcase_15 AC 329 ms
19,820 KB
testcase_16 AC 476 ms
34,188 KB
testcase_17 AC 468 ms
34,752 KB
testcase_18 AC 516 ms
38,012 KB
testcase_19 AC 605 ms
49,672 KB
testcase_20 AC 606 ms
48,248 KB
testcase_21 AC 616 ms
48,388 KB
testcase_22 AC 618 ms
48,220 KB
testcase_23 AC 643 ms
48,368 KB
testcase_24 AC 251 ms
10,880 KB
testcase_25 AC 272 ms
11,008 KB
testcase_26 AC 376 ms
49,632 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