Submission #7641153


Source Code Expand

import copy
import collections

def calc(k, balls):
    balls_count = set(copy.copy(balls))
    change_count = 0
    flg = True

    while flg == True:
        if len(balls_count) <= int(k):
            flg = False
            return change_count
        else:
            c = collections.Counter(balls)
            most_common = c.most_common()[-1]
            balls = [i for i in balls if i != most_common[0]]
            balls_count = sorted(set(copy.copy(balls)))
            change_count += int(most_common[1])


_ = input().split()
k = _[1]
balls = sorted(input().split())

print(calc(k, balls))

Submission Info

Submission Time
Task C - Not so Diverse
User fng0
Language Python (3.4.3)
Score 0
Code Size 625 Byte
Status TLE
Exec Time 2106 ms
Memory 82336 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 13
TLE × 6
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt AC 22 ms 3444 KB
10.txt AC 1842 ms 20876 KB
11.txt TLE 2105 ms 21016 KB
12.txt TLE 2106 ms 82336 KB
13.txt AC 159 ms 17852 KB
2.txt AC 22 ms 3444 KB
3.txt TLE 2105 ms 21484 KB
4.txt TLE 2105 ms 22284 KB
5.txt TLE 2104 ms 23636 KB
6.txt AC 157 ms 17564 KB
7.txt AC 53 ms 18256 KB
8.txt AC 56 ms 19336 KB
9.txt TLE 2104 ms 25372 KB
sample1.txt AC 22 ms 3444 KB
sample2.txt AC 22 ms 3444 KB
sample3.txt AC 22 ms 3444 KB