199692025-12-30 17:50:13kissmikkiProgramtermék verseny (70 pont)python3Accepted 70/7064ms14956 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, K=map(int, input().split())
    P=list(map(int, input().split()))
    szamol(N, K, P)

#test()
futtat()
SubtaskSumTestVerdictTimeMemory
base70/70
1Accepted0/016ms3468 KiB
2Accepted0/017ms3144 KiB
3Accepted0/063ms14824 KiB
4Accepted3/316ms3312 KiB
5Accepted3/317ms3284 KiB
6Accepted3/317ms3124 KiB
7Accepted3/317ms3256 KiB
8Accepted3/317ms3236 KiB
9Accepted3/317ms3108 KiB
10Accepted3/317ms3380 KiB
11Accepted3/317ms3324 KiB
12Accepted3/317ms3484 KiB
13Accepted3/318ms3660 KiB
14Accepted4/418ms3512 KiB
15Accepted4/441ms8876 KiB
16Accepted4/445ms9856 KiB
17Accepted4/448ms10788 KiB
18Accepted4/420ms4296 KiB
19Accepted4/427ms5400 KiB
20Accepted4/429ms6596 KiB
21Accepted4/459ms14820 KiB
22Accepted4/464ms14956 KiB
23Accepted4/457ms13008 KiB