115542024-10-26 18:39:00balintPontos átlag 2python3Time limit exceeded 0/1002.099s27004 KiB
def main():
    N, K = map(int, input().strip().split())
    nums = list(map(int, input().strip().split()))

    c = 1
    current_sum = sum(nums)
    to_sum = K*N
    adding = to_sum > current_sum
    if adding:
        while True:
            current_sum += N
            if current_sum >= to_sum:
                break
            c+=1

    else:
        while True:
            if c in nums:
                N -= 1
            current_sum -= N
            if current_sum <= to_sum:
                break

            c+=1

    print(c)

main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted16ms3128 KiB
2Accepted17ms2872 KiB
subtask20/10
3Accepted16ms3144 KiB
4Accepted17ms3124 KiB
5Time limit exceeded2.084s2864 KiB
6Time limit exceeded2.084s2872 KiB
7Wrong answer16ms2980 KiB
8Time limit exceeded2.099s2980 KiB
subtask30/20
9Accepted50ms7364 KiB
10Wrong answer48ms6668 KiB
11Wrong answer46ms6720 KiB
12Accepted46ms6716 KiB
13Accepted50ms7372 KiB
14Accepted50ms6644 KiB
15Wrong answer48ms6684 KiB
16Wrong answer48ms6600 KiB
17Accepted16ms3128 KiB
subtask40/24
18Time limit exceeded2.098s3124 KiB
19Time limit exceeded2.099s3028 KiB
20Time limit exceeded2.099s3108 KiB
21Wrong answer119ms3128 KiB
22Time limit exceeded2.085s3128 KiB
23Accepted456ms3216 KiB
24Time limit exceeded2.071s3132 KiB
25Wrong answer17ms3208 KiB
26Time limit exceeded2.099s3092 KiB
27Wrong answer46ms3132 KiB
28Accepted14ms2924 KiB
subtask50/46
29Wrong answer50ms6656 KiB
30Wrong answer291ms27004 KiB
31Time limit exceeded2.071s16792 KiB
32Accepted693ms22268 KiB
33Time limit exceeded2.082s26284 KiB
34Time limit exceeded2.088s26268 KiB
35Wrong answer81ms26896 KiB
36Time limit exceeded2.088s26836 KiB
37Time limit exceeded2.072s26888 KiB
38Time limit exceeded2.078s26168 KiB
39Time limit exceeded2.085s11224 KiB
40Wrong answer1.131s3688 KiB
41Accepted16ms3128 KiB