AtCoder Regular Contest 074

Submission #2780258

Source codeソースコード

from heapq import heapify, heappushpop

n = int(input())
xs = [int(x) for x in input().split()]

xs1 = xs[:n]
heapify(xs1)
r1 = [sum(xs1)]
for x in xs[n:2*n]:
    r1.append(r1[-1] + x - heappushpop(xs1, x))

xs2 = [-x for x in xs[2*n:]]
heapify(xs2)
r2 = [sum(xs2)]
for x in reversed(xs[n:2*n]):
    r2.append(r2[-1] + (-x) - heappushpop(xs2, -x))

print(max(a+b for a,b in zip(r1, reversed(r2))))

Submission

Task問題 D - 3N Numbers
User nameユーザ名 zehnpaard
Created time投稿日時
Language言語 Python3 (3.4.3)
Status状態 AC
Score得点 500
Source lengthソースコード長 414 Byte
File nameファイル名
Exec time実行時間 321 ms
Memory usageメモリ使用量 40340 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt
Subtask 300 / 300 0_00.txt,0_01.txt,0_02.txt,1_00.txt,1_01.txt,1_02.txt,1_03.txt,1_04.txt,1_05.txt,1_06.txt,1_07.txt,1_08.txt,1_09.txt,1_10.txt,1_11.txt,1_12.txt,1_13.txt,1_14.txt,1_15.txt,1_16.txt,1_17.txt,1_18.txt,1_19.txt,1_20.txt,1_21.txt,1_22.txt,1_23.txt
All 200 / 200 0_00.txt,0_01.txt,0_02.txt,1_00.txt,1_01.txt,1_02.txt,1_03.txt,1_04.txt,1_05.txt,1_06.txt,1_07.txt,1_08.txt,1_09.txt,1_10.txt,1_11.txt,1_12.txt,1_13.txt,1_14.txt,1_15.txt,1_16.txt,1_17.txt,1_18.txt,1_19.txt,1_20.txt,1_21.txt,1_22.txt,1_23.txt,2_00.txt,2_01.txt,2_02.txt,2_03.txt,2_04.txt,2_05.txt,2_06.txt,2_07.txt,2_08.txt,2_09.txt,2_10.txt,2_11.txt,2_12.txt,2_13.txt,2_14.txt,2_15.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC 18 ms 3064 KB
0_01.txt AC 18 ms 3064 KB
0_02.txt AC 18 ms 3064 KB
1_00.txt AC 18 ms 3064 KB
1_01.txt AC 18 ms 3064 KB
1_02.txt AC 18 ms 3064 KB
1_03.txt AC 18 ms 3064 KB
1_04.txt AC 18 ms 3064 KB
1_05.txt AC 18 ms 3064 KB
1_06.txt AC 18 ms 3064 KB
1_07.txt AC 18 ms 3064 KB
1_08.txt AC 19 ms 3188 KB
1_09.txt AC 20 ms 3444 KB
1_10.txt AC 20 ms 3316 KB
1_11.txt AC 20 ms 3316 KB
1_12.txt AC 19 ms 3316 KB
1_13.txt AC 20 ms 3316 KB
1_14.txt AC 19 ms 3316 KB
1_15.txt AC 19 ms 3316 KB
1_16.txt AC 19 ms 3188 KB
1_17.txt AC 19 ms 3188 KB
1_18.txt AC 19 ms 3188 KB
1_19.txt AC 19 ms 3188 KB
1_20.txt AC 20 ms 3444 KB
1_21.txt AC 20 ms 3444 KB
1_22.txt AC 20 ms 3444 KB
1_23.txt AC 20 ms 3444 KB
2_00.txt AC 162 ms 15716 KB
2_01.txt AC 200 ms 40340 KB
2_02.txt AC 246 ms 28296 KB
2_03.txt AC 224 ms 29100 KB
2_04.txt AC 209 ms 29100 KB
2_05.txt AC 215 ms 27400 KB
2_06.txt AC 213 ms 27404 KB
2_07.txt AC 187 ms 29100 KB
2_08.txt AC 180 ms 15508 KB
2_09.txt AC 190 ms 16108 KB
2_10.txt AC 188 ms 16148 KB
2_11.txt AC 185 ms 15420 KB
2_12.txt AC 302 ms 36420 KB
2_13.txt AC 303 ms 36900 KB
2_14.txt AC 302 ms 36212 KB
2_15.txt AC 321 ms 40196 KB