Submission #2552689


Source Code Expand

n = int(raw_input())
numbers = map(int, raw_input().split())
result = -3*(10**14)
for i in range (n+1):
	a = numbers[0:n+i]
	b = numbers[n+i:]
	s = sorted(a)
	d1 = sum(s[0:i])
	t = sorted(b)
	t = t[::-1]
	d2 = sum(t[:n-i])
	c = sum(a) + d2 - (sum(b) + d1)
	if c > result:
		result = c
print result



Submission Info

Submission Time
Task D - 3N Numbers
User sp557
Language Python (2.7.6)
Score 300
Code Size 319 Byte
Status TLE
Exec Time 2106 ms
Memory 28752 KB

Judge Result

Set Name Sample Subtask All
Score / Max Score 0 / 0 300 / 300 0 / 200
Status
AC × 3
AC × 27
AC × 27
TLE × 16
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
Subtask 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 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
Case Name Status Exec Time Memory
0_00.txt AC 11 ms 2568 KB
0_01.txt AC 10 ms 2568 KB
0_02.txt AC 10 ms 2568 KB
1_00.txt AC 11 ms 2568 KB
1_01.txt AC 10 ms 2568 KB
1_02.txt AC 10 ms 2568 KB
1_03.txt AC 10 ms 2568 KB
1_04.txt AC 10 ms 2568 KB
1_05.txt AC 10 ms 2568 KB
1_06.txt AC 10 ms 2568 KB
1_07.txt AC 10 ms 2568 KB
1_08.txt AC 92 ms 2692 KB
1_09.txt AC 83 ms 2876 KB
1_10.txt AC 86 ms 2796 KB
1_11.txt AC 87 ms 2796 KB
1_12.txt AC 87 ms 2796 KB
1_13.txt AC 87 ms 2796 KB
1_14.txt AC 87 ms 2796 KB
1_15.txt AC 88 ms 2796 KB
1_16.txt AC 246 ms 2692 KB
1_17.txt AC 246 ms 2692 KB
1_18.txt AC 243 ms 2692 KB
1_19.txt AC 243 ms 2692 KB
1_20.txt AC 455 ms 2880 KB
1_21.txt AC 471 ms 2876 KB
1_22.txt AC 467 ms 2876 KB
1_23.txt AC 465 ms 2876 KB
2_00.txt TLE 2105 ms 16884 KB
2_01.txt TLE 2106 ms 28752 KB
2_02.txt TLE 2104 ms 23820 KB
2_03.txt TLE 2105 ms 21772 KB
2_04.txt TLE 2105 ms 21772 KB
2_05.txt TLE 2105 ms 21772 KB
2_06.txt TLE 2105 ms 21772 KB
2_07.txt TLE 2105 ms 21772 KB
2_08.txt TLE 2105 ms 16668 KB
2_09.txt TLE 2105 ms 16680 KB
2_10.txt TLE 2105 ms 16776 KB
2_11.txt TLE 2105 ms 16560 KB
2_12.txt TLE 2106 ms 28472 KB
2_13.txt TLE 2106 ms 28696 KB
2_14.txt TLE 2106 ms 28696 KB
2_15.txt TLE 2104 ms 28576 KB