59802023-10-09 08:43:05dfehervariKártyajátékpython3Accepted 30/30128ms37436 KiB
from sys import stdin, stderr

def main():
    N, K = (int(x) for x in stdin.readline().split())
    hand = [int(x) for x in stdin.readline().split()]
    q = sorted(hand)[::-1]
    last, pts = 0, 0
    for x in hand:
        if (x < last): continue
        last = x
        if q[-1] < x: pts += 1
        while len(q) > 0 and q[-1] <= x:
            q.pop()
    print(pts)

main()

SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/017ms11120 KiB
2Accepted0/0127ms36280 KiB
3Accepted1/117ms11428 KiB
4Accepted1/117ms11604 KiB
5Accepted1/117ms11580 KiB
6Accepted2/217ms11876 KiB
7Accepted2/218ms11896 KiB
8Accepted2/217ms12364 KiB
9Accepted1/175ms27720 KiB
10Accepted2/2105ms33744 KiB
11Accepted3/3107ms33956 KiB
12Accepted3/3111ms33952 KiB
13Accepted1/1123ms37148 KiB
14Accepted2/2128ms37220 KiB
15Accepted3/3125ms37204 KiB
16Accepted3/3126ms37436 KiB
17Accepted3/3128ms37244 KiB