157532025-02-26 13:01:56MangoOsztozkodás (75 pont)python3Runtime error 0/7517ms3368 KiB
a = int(input())
v = int(input())
e = 0
m = 0
tsz = 0
mx = 0
mxx = 0
h = 0
aé = input()
aé = aé.split()
for i in range(a):
    aé[i] = int(aé[i])

for j in range(a):
    h += aé[j]

mxxx = max(aé)

for i in range(a):
    if i + 1 == a - v:
        if tsz == 0:
            e = h - m
        else:
            m = h - e
    else:
        if tsz == 0:
            mx = 0
            for f in range(a - (i + 1)):
                if aé[f] > mx:
                    mx = aé[f]
                    if mxxx == mx:
                        e += mxx
                        mxxx = mxx
                        tsz = 1
                    else:
                        mxx = aé[f]
        else:
            mx = 0

            for g in range(a - (i + 1)):
                if aé[g] > mx:
                    mx = aé[g]
                    if mxxx == mx:
                        m += mxx
                        mxxx = mxx
                        tsz = 0
                    else:
                        mxx = aé[g]

print (e,m)
                    



 
SubtaskSumTestVerdictTimeMemory
base0/75
1Runtime error0/017ms3312 KiB
2Runtime error0/016ms2956 KiB
3Runtime error0/216ms3128 KiB
4Runtime error0/316ms3124 KiB
5Runtime error0/317ms2972 KiB
6Runtime error0/216ms3124 KiB
7Runtime error0/316ms3104 KiB
8Runtime error0/216ms3124 KiB
9Runtime error0/316ms3240 KiB
10Runtime error0/216ms3092 KiB
11Runtime error0/316ms3040 KiB
12Runtime error0/116ms3124 KiB
13Runtime error0/216ms3000 KiB
14Runtime error0/116ms3080 KiB
15Runtime error0/216ms3124 KiB
16Runtime error0/116ms3020 KiB
17Runtime error0/217ms3120 KiB
18Runtime error0/116ms3320 KiB
19Runtime error0/216ms3128 KiB
20Runtime error0/216ms3316 KiB
21Runtime error0/317ms3064 KiB
22Runtime error0/216ms3232 KiB
23Runtime error0/316ms3128 KiB
24Runtime error0/216ms3208 KiB
25Runtime error0/317ms3124 KiB
26Runtime error0/217ms3124 KiB
27Runtime error0/316ms3368 KiB
28Runtime error0/216ms3124 KiB
29Runtime error0/317ms3116 KiB
30Runtime error0/317ms3360 KiB
31Runtime error0/317ms3124 KiB
32Runtime error0/316ms3044 KiB
33Runtime error0/316ms2980 KiB
34Runtime error0/316ms2972 KiB