Submission #23971683


Source Code Expand

n, k = map(int, input().split())
a = list(map(int, input().split()))

base = k // n
rest = k % n

res = [base] * n

a_num = []
for i, v in enumerate(a):
    a_num += [[v, i]]

a_num.sort()

for u, j in a_num:
    if rest > 0:
        res[j] += 1
        rest -= 1
    else:
        break

print('\n'.join(map(str, res)))
   

Submission Info

Submission Time
Task C - Fair Candy Distribution
User cubesat
Language Python (3.8.2)
Score 300
Code Size 346 Byte
Status AC
Exec Time 643 ms
Memory 66480 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 25
Set Name Test Cases
Sample sample_00.txt, sample_01.txt, sample_02.txt
All exact_div_00.txt, k_lt_n_00.txt, max_00.txt, max_01.txt, max_ascend_00.txt, max_ascend_01.txt, max_descend_00.txt, max_descend_01.txt, max_random_00.txt, max_random_01.txt, n_k_small_00.txt, n_k_small_01.txt, n_k_small_02.txt, n_k_small_03.txt, n_k_small_04.txt, n_small_00.txt, n_small_01.txt, n_small_02.txt, n_small_03.txt, n_small_04.txt, random_00.txt, random_01.txt, sample_00.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
exact_div_00.txt AC 71 ms 16024 KiB
k_lt_n_00.txt AC 125 ms 21324 KiB
max_00.txt AC 623 ms 65708 KiB
max_01.txt AC 643 ms 66480 KiB
max_ascend_00.txt AC 236 ms 64116 KiB
max_ascend_01.txt AC 233 ms 63912 KiB
max_descend_00.txt AC 242 ms 64004 KiB
max_descend_01.txt AC 235 ms 64204 KiB
max_random_00.txt AC 599 ms 64092 KiB
max_random_01.txt AC 601 ms 64004 KiB
n_k_small_00.txt AC 23 ms 9156 KiB
n_k_small_01.txt AC 18 ms 9084 KiB
n_k_small_02.txt AC 18 ms 8888 KiB
n_k_small_03.txt AC 18 ms 8984 KiB
n_k_small_04.txt AC 18 ms 9016 KiB
n_small_00.txt AC 18 ms 8884 KiB
n_small_01.txt AC 18 ms 9148 KiB
n_small_02.txt AC 25 ms 8892 KiB
n_small_03.txt AC 21 ms 8976 KiB
n_small_04.txt AC 20 ms 8892 KiB
random_00.txt AC 316 ms 40200 KiB
random_01.txt AC 273 ms 39552 KiB
sample_00.txt AC 25 ms 9000 KiB
sample_01.txt AC 23 ms 8888 KiB
sample_02.txt AC 20 ms 9076 KiB