Submission #17510541


Source Code Expand

Copy
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main(N, A, B):
    base_score = B.sum()
    A = A - B
    X, Y = A[::2], A[1::2]
    X.sort()
    Y.sort()
    X = X[::-1]
    Y = Y[::-1]
    best = base_score
    add = 0
    for i in range(N // 2):
        x, y = X[i], Y[i]
        add += x + y
        best = max(best, base_score + add)
    return best

N = int(readline())
A = np.array(readline().split(), np.int64)
B = np.array(readline().split(), np.int64)

print(main(N, A, B))

Submission Info

Submission Time
Task B - Bracket Score
User maspy
Language Python (3.8.2)
Score 700
Code Size 603 Byte
Status AC
Exec Time 204 ms
Memory 35092 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 2
AC × 23
Set Name Test Cases
Sample 00-sample-001.txt, 00-sample-002.txt
All 00-sample-001.txt, 00-sample-002.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt, 01-020.txt, 01-021.txt
Case Name Status Exec Time Memory
00-sample-001.txt AC 119 ms 26704 KB
00-sample-002.txt AC 114 ms 26720 KB
01-001.txt AC 112 ms 27052 KB
01-002.txt AC 113 ms 27268 KB
01-003.txt AC 115 ms 27116 KB
01-004.txt AC 116 ms 27028 KB
01-005.txt AC 114 ms 27008 KB
01-006.txt AC 114 ms 26824 KB
01-007.txt AC 116 ms 27052 KB
01-008.txt AC 124 ms 26968 KB
01-009.txt AC 126 ms 27084 KB
01-010.txt AC 112 ms 27288 KB
01-011.txt AC 112 ms 26988 KB
01-012.txt AC 193 ms 35020 KB
01-013.txt AC 197 ms 34788 KB
01-014.txt AC 202 ms 35092 KB
01-015.txt AC 203 ms 34796 KB
01-016.txt AC 200 ms 34880 KB
01-017.txt AC 204 ms 34832 KB
01-018.txt AC 197 ms 34488 KB
01-019.txt AC 198 ms 34920 KB
01-020.txt AC 199 ms 34928 KB
01-021.txt AC 201 ms 34812 KB