def LID(): ilosc = int(input()) tabWartosci = input() tabWartosci = tabWartosci.split(" ") tabIlosci = [0]*ilosc for i in range(ilosc): tabIlosci[int(tabWartosci[i])-1]+=1 tabIlosci.sort(reverse=True) suma=0 ile=0 for i in tabIlosci: suma+=i*2-1 ile+=1 if suma>=ilosc: return ile print(LID())
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | def LID(): ilosc = int(input()) tabWartosci = input() tabWartosci = tabWartosci.split(" ") tabIlosci = [0]*ilosc for i in range(ilosc): tabIlosci[int(tabWartosci[i])-1]+=1 tabIlosci.sort(reverse=True) suma=0 ile=0 for i in tabIlosci: suma+=i*2-1 ile+=1 if suma>=ilosc: return ile print(LID()) |