結果

問題 No.2196 Pair Bonus
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-01-20 22:17:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 487 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 140,940 KB
最終ジャッジ日時 2023-09-05 14:35:10
合計ジャッジ時間 4,681 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,348 KB
testcase_01 AC 75 ms
71,332 KB
testcase_02 AC 75 ms
71,412 KB
testcase_03 AC 229 ms
137,280 KB
testcase_04 AC 228 ms
137,516 KB
testcase_05 AC 79 ms
75,844 KB
testcase_06 AC 80 ms
75,660 KB
testcase_07 AC 79 ms
75,932 KB
testcase_08 AC 115 ms
85,476 KB
testcase_09 AC 227 ms
140,940 KB
testcase_10 AC 179 ms
114,500 KB
testcase_11 AC 119 ms
87,956 KB
testcase_12 AC 197 ms
116,984 KB
testcase_13 AC 79 ms
75,600 KB
testcase_14 AC 104 ms
79,132 KB
testcase_15 AC 81 ms
75,600 KB
testcase_16 AC 218 ms
127,824 KB
testcase_17 AC 86 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
X = list(map(int,input().split()))
Y = list(map(int,input().split()))

score = 0
change = []
for i in range(n):
    a1,a2 = A[2*i],A[2*i+1]
    b1,b2 = B[2*i],B[2*i+1]

    x,y = X[i],Y[i]
    same = max(a1+a2,b1+b2)+x
    dif = max(a1+b2,a2+b1)+y
    score += same
    change.append(dif-same)

ans = score
change.sort(reverse=True)
for c in change:
    score += c
    ans = max(ans,score)
print(ans)
0