199682025-12-30 17:48:10kissmikkiProgramtermék verseny (70 pont)python3Runtime error 0/7017ms3504 KiB
import sys

def szamol(N, K, P):
    maxI = int(N/12)
    maxII = int(N/4)
    maxIII = int(N/2)

    Bendeguz=P[K-1]
    print("Bendeguz=", Bendeguz, file=sys.stderr)
    helyezes=1
    for v in range(0, K):
        if P[v]>Bendeguz:
            helyezes=helyezes+1
    i = 0
    ii = 0
    iii = 0
    if helyezes<=maxI:
        i = K
    if helyezes<=maxII:
        ii = K
    if helyezes<=maxIII:
        iii = K
    print("helyezes=", helyezes, file=sys.stderr)
    print("maxI  =", maxI, file=sys.stderr)
    print("maxII =", maxII, file=sys.stderr)
    print("maxIII=", maxIII, file=sys.stderr)
    for v in range(K, N):
        # print("P[",v,"]=",P[v], file=sys.stderr)
        if P[v]>Bendeguz:
            helyezes=helyezes+1
        if helyezes<=maxI:
            i=i+1
        if helyezes<=maxII:
            ii=ii+1
        if helyezes<=maxIII:
            iii=iii+1
    if helyezes<maxII:
        iii=0
    if helyezes<maxI:
        ii=0
    print("helyezes=", helyezes, file=sys.stderr)

    print(i)
    print(ii)
    print(iii)
    return i, ii, iii

def test():
    i, ii, iii=szamol(12, 3, [1, 2, 20, 5, 21, 22, 26, 27, 23, 28, 24, 25])
    assert 4==i
    assert 6==ii
    assert 9==iii

    i, ii, iii=szamol(12, 12, [1, 2, 20, 5, 21, 22, 26, 25, 23, 28, 24, 27])
    assert 0==i
    assert 12==ii
    assert 0==iii

def futtat():
    N=int(input())
    K=int(input())
    P=list(map(int, input().split()))
    szamol(N, K, P)

#test()
futtat()
SubtaskSumTestVerdictTimeMemory
base0/70
1Runtime error0/017ms3136 KiB
2Runtime error0/017ms3124 KiB
3Runtime error0/017ms3124 KiB
4Runtime error0/317ms3124 KiB
5Runtime error0/316ms3284 KiB
6Runtime error0/317ms3132 KiB
7Runtime error0/316ms3164 KiB
8Runtime error0/317ms3088 KiB
9Runtime error0/317ms3124 KiB
10Runtime error0/316ms3280 KiB
11Runtime error0/317ms3220 KiB
12Runtime error0/317ms3288 KiB
13Runtime error0/316ms3160 KiB
14Runtime error0/417ms3292 KiB
15Runtime error0/416ms3308 KiB
16Runtime error0/416ms3288 KiB
17Runtime error0/417ms3312 KiB
18Runtime error0/417ms3124 KiB
19Runtime error0/417ms3504 KiB
20Runtime error0/417ms3320 KiB
21Runtime error0/416ms3220 KiB
22Runtime error0/416ms3192 KiB
23Runtime error0/417ms3212 KiB