Submission details
Task:Wheel of fortune
Sender:aalto26cm_016
Submission time:2026-09-14 17:10:46 +0300
Language:Python3 (PyPy3)
Status:READY
Result:
Test results
testverdicttime
#10.04 sdetails
#20.04 sdetails
#30.04 sdetails
#40.04 sdetails
#50.04 sdetails
#60.04 sdetails
#70.04 sdetails
#80.04 sdetails
#90.04 sdetails
#100.04 sdetails
#110.04 sdetails
#120.04 sdetails
#130.04 sdetails
#140.04 sdetails
#150.04 sdetails
#160.04 sdetails
#170.04 sdetails
#180.04 sdetails
#190.04 sdetails
#200.04 sdetails
#210.04 sdetails
#220.06 sdetails
#230.04 sdetails
#240.04 sdetails
#250.04 sdetails
#260.04 sdetails
#270.04 sdetails
#280.04 sdetails
#290.06 sdetails
#300.06 sdetails
#310.06 sdetails
#320.06 sdetails
#330.06 sdetails
#340.06 sdetails
#350.06 sdetails
#360.06 sdetails
#370.07 sdetails
#380.04 sdetails
#390.04 sdetails
#400.04 sdetails
#410.04 sdetails
#420.04 sdetails
#430.04 sdetails
#440.04 sdetails
#450.04 sdetails
#460.04 sdetails
#470.04 sdetails
#480.04 sdetails
#490.04 sdetails
#500.04 sdetails
#510.04 sdetails
#520.04 sdetails
#530.04 sdetails
#540.04 sdetails
#550.04 sdetails
#560.04 sdetails
#570.04 sdetails
#580.04 sdetails
#590.04 sdetails
#600.04 sdetails
#610.04 sdetails
#620.04 sdetails
#630.04 sdetails
#640.04 sdetails
#650.04 sdetails
#660.04 sdetails
#670.04 sdetails
#680.04 sdetails
#690.04 sdetails
#700.04 sdetails
#710.04 sdetails
#720.04 sdetails
#730.04 sdetails
#740.04 sdetails
#750.04 sdetails
#760.04 sdetails
#770.04 sdetails
#780.06 sdetails
#790.06 sdetails
#800.06 sdetails
#810.06 sdetails
#820.06 sdetails
#830.06 sdetails
#840.06 sdetails
#850.06 sdetails
#860.07 sdetails
#870.17 sdetails
#880.17 sdetails
#890.17 sdetails
#900.04 sdetails
#910.04 sdetails
#920.04 sdetails
#930.04 sdetails
#940.04 sdetails
#950.04 sdetails
#960.06 sdetails
#970.06 sdetails
#980.07 sdetails
#990.17 sdetails
#1000.04 sdetails

Code

n = int(input())
c = list(map(int, input().split()))

smallest_value = float(-10**9)

def gain(i, color):
    if color == 0:
        return c[i]
    elif color == 1:
        return -c[i]
    else:
        return 0

best = smallest_value
for first in range(3):

    best_total_color = [smallest_value, smallest_value, smallest_value]
    best_total_color[first] = gain(0, first)
    for i in range(1, n):
        next_best_total = [smallest_value, smallest_value, smallest_value]
        for color in range(3):
            g = gain(i, color)
            m = smallest_value
            for previous_color in range(3):
                if  best_total_color[previous_color] > m:
                    m = best_total_color[previous_color]
            if m != smallest_value:
                next_best_total[color] = m + g
        best_total_color = next_best_total
    for color in range(3):
        if color != first and best_total_color[color] > best:
            best = best_total_color[color]

print(best)

Test details

Test 1

Verdict:

input
3
41702 99720 72033 

correct output
58018

user output
171753

Feedback: Incorrect character on line 1 col 1: expected "58018", got "171753"

Test 2

Verdict:

input
4
41702 99720 72033 93257 

correct output
192977

user output
265010

Feedback: Incorrect character on line 1 col 1: expected "192977", got "265010"

Test 3

Verdict:

input
5
41702 99720 72033 93257 11 

correct output
192966

user output
306712

Feedback: Incorrect character on line 1 col 1: expected "192966", got "306712"

Test 4

Verdict:

input
6
41702 99720 72033 93257 11 128...

correct output
205789

user output
306723

Feedback: Incorrect character on line 1 col 1: expected "205789", got "306723"

Test 5

Verdict:

input
7
41702 99720 72033 93257 11 128...

correct output
223199

user output
319535

Feedback: Incorrect character on line 1 col 1: expected "223199", got "319535"

Test 6

Verdict:

input
10
41702 99720 72033 93257 11 128...

correct output
329303

user output
464348

Feedback: Incorrect character on line 1 col 1: expected "329303", got "464348"

Test 7

Verdict:

input
3
43600 18508 2592 

correct output
41008

user output
62108

Feedback: Incorrect character on line 1 col 1: expected "41008", got "62108"

Test 8

Verdict:

input
4
43600 18508 2592 93155 

correct output
111663

user output
114255

Feedback: Incorrect character on line 1 col 3: expected "111663", got "114255"

Test 9

Verdict:

input
5
43600 18508 2592 93155 54967 

correct output
134163

user output
169222

Feedback: Incorrect character on line 1 col 2: expected "134163", got "169222"

Test 10

Verdict:

input
6
43600 18508 2592 93155 54967 9...

correct output
206437

user output
263996

Feedback: Incorrect character on line 1 col 2: expected "206437", got "263996"

Test 11

Verdict:

input
7
43600 18508 2592 93155 54967 9...

correct output
228937

user output
307596

Feedback: Incorrect character on line 1 col 1: expected "228937", got "307596"

Test 12

Verdict:

input
10
43600 18508 2592 93155 54967 9...

correct output
286966

user output
441640

Feedback: Incorrect character on line 1 col 1: expected "286966", got "441640"

Test 13

Verdict:

input
3
55080 7072 70815 

correct output
63743

user output
77887

Feedback: Incorrect character on line 1 col 1: expected "63743", got "77887"

Test 14

Verdict:

input
4
55080 7072 70815 83996 

correct output
125895

user output
161883

Feedback: Incorrect character on line 1 col 2: expected "125895", got "161883"

Test 15

Verdict:

input
5
55080 7072 70815 83996 29090 

correct output
132004

user output
216963

Feedback: Incorrect character on line 1 col 1: expected "132004", got "216963"

Test 16

Verdict:

input
6
55080 7072 70815 83996 29090 1...

correct output
154985

user output
246053

Feedback: Incorrect character on line 1 col 1: expected "154985", got "246053"

Test 17

Verdict:

input
7
55080 7072 70815 83996 29090 1...

correct output
144137

user output
258186

Feedback: Incorrect character on line 1 col 1: expected "144137", got "258186"

Test 18

Verdict:

input
10
96704 90063 54724 17269 97269 ...

correct output
389952

user output
643751

Feedback: Incorrect character on line 1 col 1: expected "389952", got "643751"

Test 19

Verdict:

input
3
96704 90063 54724 

correct output
41980

user output
186767

Feedback: Incorrect character on line 1 col 1: expected "41980", got "186767"

Test 20

Verdict:

input
4
96704 90063 54724 17269 

correct output
151428

user output
241491

Feedback: Incorrect character on line 1 col 1: expected "151428", got "241491"

Test 21

Verdict:

input
5
96704 90063 54724 17269 97269 

correct output
170063

user output
259325

Feedback: Incorrect character on line 1 col 1: expected "170063", got "259325"

Test 22

Verdict:

input
6
96704 90063 54724 17269 97269 ...

correct output
248697

user output
356029

Feedback: Incorrect character on line 1 col 1: expected "248697", got "356029"

Test 23

Verdict:

input
7
96704 90063 54724 17269 97269 ...

correct output
241545

user output
441592

Feedback: Incorrect character on line 1 col 1: expected "241545", got "441592"

Test 24

Verdict:

input
10
96704 90063 54724 17269 97269 ...

correct output
389952

user output
643751

Feedback: Incorrect character on line 1 col 1: expected "389952", got "643751"

Test 25

Verdict:

input
50
41702 99720 72033 93257 11 128...

correct output
1508857

user output
2566835

Feedback: Incorrect character on line 1 col 1: expected "1508857", got "2566835"

Test 26

Verdict:

input
50
43600 18508 2592 93155 54967 9...

correct output
1261022

user output
2141995

Feedback: Incorrect character on line 1 col 1: expected "1261022", got "2141995"

Test 27

Verdict:

input
50
55080 7072 70815 83996 29090 1...

correct output
1204485

user output
2096436

Feedback: Incorrect character on line 1 col 1: expected "1204485", got "2096436"

Test 28

Verdict:

input
50
96704 90063 54724 17269 97269 ...

correct output
1548881

user output
2624496

Feedback: Incorrect character on line 1 col 1: expected "1548881", got "2624496"

Test 29

Verdict:

input
250
41702 99720 72033 93257 11 128...

correct output
7048856

user output
12248459

Feedback: Incorrect character on line 1 col 1: expected "7048856", got "12248459"

Test 30

Verdict:

input
250
43600 18508 2592 93155 54967 9...

correct output
7355456

user output
13039445

Feedback: Incorrect character on line 1 col 1: expected "7355456", got "13039445"

Test 31

Verdict:

input
250
55080 7072 70815 83996 29090 1...

correct output
6879335

user output
12148649

Feedback: Incorrect character on line 1 col 1: expected "6879335", got "12148649"

Test 32

Verdict:

input
250
96704 90063 54724 17269 97269 ...

correct output
7241700

user output
12516715

Feedback: Incorrect character on line 1 col 1: expected "7241700", got "12516715"

Test 33

Verdict:

input
900
41702 99720 72033 93257 11 128...

correct output
25585084

user output
44128299

Feedback: Incorrect character on line 1 col 1: expected "25585084", got "44128299"

Test 34

Verdict:

input
900
43600 18508 2592 93155 54967 9...

correct output
25559325

user output
44325100

Feedback: Incorrect character on line 1 col 1: expected "25559325", got "44325100"

Test 35

Verdict:

input
900
55080 7072 70815 83996 29090 1...

correct output
25395388

user output
44947701

Feedback: Incorrect character on line 1 col 1: expected "25395388", got "44947701"

Test 36

Verdict:

input
900
96704 90063 54724 17269 97269 ...

correct output
25722421

user output
45116153

Feedback: Incorrect character on line 1 col 1: expected "25722421", got "45116153"

Test 37

Verdict:

input
10000
41702 99720 72033 93257 11 128...

correct output
286456959

user output
500543827

Feedback: Incorrect character on line 1 col 1: expected "286456959", got "500543827"

Test 38

Verdict:

input
3
2 3 3 

correct output
1

user output
6

Feedback: Incorrect character on line 1 col 1: expected "1", got "6"

Test 39

Verdict:

input
4
2 4 3 4 

correct output
8

user output
11

Feedback: Incorrect character on line 1 col 1: expected "8", got "11"

Test 40

Verdict:

input
5
3 5 4 5 1 

correct output
9

user output
17

Feedback: Incorrect character on line 1 col 1: expected "9", got "17"

Test 41

Verdict:

input
6
3 6 5 6 1 1 

correct output
13

user output
21

Feedback: Incorrect character on line 1 col 1: expected "13", got "21"

Test 42

Verdict:

input
7
3 7 6 7 1 1 3 

correct output
16

user output
25

Feedback: Incorrect character on line 1 col 1: expected "16", got "25"

Test 43

Verdict:

input
10
5 10 8 10 1 2 4 10 2 3 

correct output
35

user output
52

Feedback: Incorrect character on line 1 col 1: expected "35", got "52"

Test 44

Verdict:

input
3
2 1 1 

correct output
1

user output
3

Feedback: Incorrect character on line 1 col 1: expected "1", got "3"

Test 45

Verdict:

input
4
2 1 1 4 

correct output
5

user output
6

Feedback: Incorrect character on line 1 col 1: expected "5", got "6"

Test 46

Verdict:

input
5
3 1 1 5 3 

correct output
7

user output
10

Feedback: Incorrect character on line 1 col 1: expected "7", got "10"

Test 47

Verdict:

input
6
3 2 1 6 4 6 

correct output
14

user output
19

Feedback: Incorrect character on line 1 col 2: expected "14", got "19"

Test 48

Verdict:

input
7
4 2 1 7 4 7 4 

correct output
17

user output
25

Feedback: Incorrect character on line 1 col 1: expected "17", got "25"

Test 49

Verdict:

input
10
5 2 1 10 6 10 5 5 5 4 

correct output
31

user output
49

Feedback: Incorrect character on line 1 col 1: expected "31", got "49"

Test 50

Verdict:

input
3
2 3 3 

correct output
1

user output
6

Feedback: Incorrect character on line 1 col 1: expected "1", got "6"

Test 51

Verdict:

input
4
2 4 3 4 

correct output
8

user output
11

Feedback: Incorrect character on line 1 col 1: expected "8", got "11"

Test 52

Verdict:

input
5
3 5 4 5 1 

correct output
9

user output
17

Feedback: Incorrect character on line 1 col 1: expected "9", got "17"

Test 53

Verdict:

input
6
3 6 5 6 1 1 

correct output
13

user output
21

Feedback: Incorrect character on line 1 col 1: expected "13", got "21"

Test 54

Verdict:

input
7
3 7 6 7 1 1 3 

correct output
16

user output
25

Feedback: Incorrect character on line 1 col 1: expected "16", got "25"

Test 55

Verdict:

input
10
5 10 8 10 1 2 4 10 2 3 

correct output
35

user output
52

Feedback: Incorrect character on line 1 col 1: expected "35", got "52"

Test 56

Verdict:

input
3
2 1 1 

correct output
1

user output
3

Feedback: Incorrect character on line 1 col 1: expected "1", got "3"

Test 57

Verdict:

input
4
2 1 1 4 

correct output
5

user output
6

Feedback: Incorrect character on line 1 col 1: expected "5", got "6"

Test 58

Verdict:

input
5
3 1 1 5 3 

correct output
7

user output
10

Feedback: Incorrect character on line 1 col 1: expected "7", got "10"

Test 59

Verdict:

input
6
3 2 1 6 4 6 

correct output
14

user output
19

Feedback: Incorrect character on line 1 col 2: expected "14", got "19"

Test 60

Verdict:

input
7
4 2 1 7 4 7 4 

correct output
17

user output
25

Feedback: Incorrect character on line 1 col 1: expected "17", got "25"

Test 61

Verdict:

input
10
5 2 1 10 6 10 5 5 5 4 

correct output
31

user output
49

Feedback: Incorrect character on line 1 col 1: expected "31", got "49"

Test 62

Verdict:

input
3
2 1 3 

correct output
2

user output
4

Feedback: Incorrect character on line 1 col 1: expected "2", got "4"

Test 63

Verdict:

input
4
3 1 3 4 

correct output
6

user output
8

Feedback: Incorrect character on line 1 col 1: expected "6", got "8"

Test 64

Verdict:

input
5
3 1 4 5 2 

correct output
7

user output
13

Feedback: Incorrect character on line 1 col 1: expected "7", got "13"

Test 65

Verdict:

input
6
4 1 5 6 2 1 

correct output
11

user output
18

Feedback: Incorrect character on line 1 col 2: expected "11", got "18"

Test 66

Verdict:

input
7
4 1 5 6 3 1 4 

correct output
11

user output
20

Feedback: Incorrect character on line 1 col 1: expected "11", got "20"

Test 67

Verdict:

input
10
10 10 6 2 10 9 8 7 7 6 

correct output
41

user output
69

Feedback: Incorrect character on line 1 col 1: expected "41", got "69"

Test 68

Verdict:

input
3
3 3 2 

correct output
1

user output
6

Feedback: Incorrect character on line 1 col 1: expected "1", got "6"

Test 69

Verdict:

input
4
4 4 3 1 

correct output
7

user output
11

Feedback: Incorrect character on line 1 col 1: expected "7", got "11"

Test 70

Verdict:

input
5
5 5 3 1 5 

correct output
9

user output
14

Feedback: Incorrect character on line 1 col 1: expected "9", got "14"

Test 71

Verdict:

input
6
6 6 4 2 6 6 

correct output
16

user output
24

Feedback: Incorrect character on line 1 col 1: expected "16", got "24"

Test 72

Verdict:

input
7
7 7 4 2 7 6 6 

correct output
18

user output
33

Feedback: Incorrect character on line 1 col 1: expected "18", got "33"

Test 73

Verdict:

input
10
10 10 6 2 10 9 8 7 7 6 

correct output
41

user output
69

Feedback: Incorrect character on line 1 col 1: expected "41", got "69"

Test 74

Verdict:

input
50
21 50 37 47 1 7 16 50 8 12 5 2...

correct output
764

user output
1305

Feedback: Incorrect character on line 1 col 1: expected "764", got "1305"

Test 75

Verdict:

input
50
22 10 2 47 28 48 22 25 22 17 1...

correct output
641

user output
1094

Feedback: Incorrect character on line 1 col 1: expected "641", got "1094"

Test 76

Verdict:

input
50
28 4 36 42 15 7 26 29 45 22 45...

correct output
610

user output
1070

Feedback: Incorrect character on line 1 col 1: expected "610", got "1070"

Test 77

Verdict:

input
50
49 46 28 9 49 43 36 31 35 30 1...

correct output
783

user output
1336

Feedback: Incorrect character on line 1 col 1: expected "783", got "1336"

Test 78

Verdict:

input
250
105 250 181 234 1 33 76 250 37...

correct output
17676

user output
30747

Feedback: Incorrect character on line 1 col 1: expected "17676", got "30747"

Test 79

Verdict:

input
250
109 47 7 233 138 237 109 122 1...

correct output
18449

user output
32726

Feedback: Incorrect character on line 1 col 1: expected "18449", got "32726"

Test 80

Verdict:

input
250
138 18 178 210 73 31 128 143 2...

correct output
17250

user output
30500

Feedback: Incorrect character on line 1 col 1: expected "17250", got "30500"

Test 81

Verdict:

input
250
242 226 137 44 244 214 179 153...

correct output
18157

user output
31416

Feedback: Incorrect character on line 1 col 1: expected "18157", got "31416"

Test 82

Verdict:

input
900
376 898 649 840 1 116 273 900 ...

correct output
230450

user output
397595

Feedback: Incorrect character on line 1 col 1: expected "230450", got "397595"

Test 83

Verdict:

input
900
393 167 24 839 495 853 392 437...

correct output
230221

user output
399367

Feedback: Incorrect character on line 1 col 1: expected "230221", got "399367"

Test 84

Verdict:

input
900
496 64 638 756 262 110 460 513...

correct output
228745

user output
404978

Feedback: Incorrect character on line 1 col 1: expected "228745", got "404978"

Test 85

Verdict:

input
900
871 811 493 156 876 771 644 54...

correct output
231686

user output
406492

Feedback: Incorrect character on line 1 col 1: expected "231686", got "406492"

Test 86

Verdict:

input
10000
4171 9972 7204 9326 2 1282 302...

correct output
28647603

user output
50059200

Feedback: Incorrect character on line 1 col 1: expected "28647603", got "50059200"

Test 87

Verdict:

input
100000
41703 99721 72034 93258 12 128...

correct output
2838931183

user output
4991792725

Feedback: Incorrect character on line 1 col 1: expected "2838931183", got "4991792725"

Test 88

Verdict:

input
100000
43601 18509 2593 93156 54968 9...

correct output
2842573127

user output
4998795620

Feedback: Incorrect character on line 1 col 1: expected "2842573127", got "4998795620"

Test 89

Verdict:

input
100000
55081 7073 70816 83997 29091 1...

correct output
2839271262

user output
5000958332

Feedback: Incorrect character on line 1 col 1: expected "2839271262", got "5000958332"

Test 90

Verdict:

input
4
100000 100000 100000 100000 

correct output
200000

user output
300000

Feedback: Incorrect character on line 1 col 1: expected "200000", got "300000"

Test 91

Verdict:

input
5
100000 100000 100000 100000 10...

correct output
100000

user output
400000

Feedback: Incorrect character on line 1 col 1: expected "100000", got "400000"

Test 92

Verdict:

input
6
100000 100000 100000 100000 10...

correct output
300000

user output
500000

Feedback: Incorrect character on line 1 col 1: expected "300000", got "500000"

Test 93

Verdict:

input
7
100000 100000 100000 100000 10...

correct output
200000

user output
600000

Feedback: Incorrect character on line 1 col 1: expected "200000", got "600000"

Test 94

Verdict:

input
10
100000 100000 100000 100000 10...

correct output
500000

user output
900000

Feedback: Incorrect character on line 1 col 1: expected "500000", got "900000"

Test 95

Verdict:

input
50
100000 100000 100000 100000 10...

correct output
2500000

user output
4900000

Feedback: Incorrect character on line 1 col 1: expected "2500000", got "4900000"

Test 96

Verdict:

input
250
100000 100000 100000 100000 10...

correct output
12500000

user output
24900000

Feedback: Incorrect character on line 1 col 1: expected "12500000", got "24900000"

Test 97

Verdict:

input
900
100000 100000 100000 100000 10...

correct output
45000000

user output
89900000

Feedback: Incorrect character on line 1 col 1: expected "45000000", got "89900000"

Test 98

Verdict:

input
10000
100000 100000 100000 100000 10...

correct output
500000000

user output
999900000

Feedback: Incorrect character on line 1 col 1: expected "500000000", got "999900000"

Test 99

Verdict:

input
100000
100000 100000 100000 100000 10...

correct output
5000000000

user output
9999900000

Feedback: Incorrect character on line 1 col 1: expected "5000000000", got "9999900000"

Test 100

Verdict:

input
3
100000 100000 100000 

correct output
0

user output
200000

Feedback: Incorrect character on line 1 col 1: expected "0", got "200000"