Submission #1468255


Source Code Expand

Copy
def main():
    k = int(input())
    for n in range(50, 1, -1):
        clear = k // n + 1
        additional = n - k % n
        a = clear + n - 1
        if(a >= 0 and a <= 10**16 + 1000):
            lst = [a] * n
            for i in range(additional):
                m = max(lst)
                forbidden = -1
                for i, item in enumerate(lst):
                    if(item == m):
                        forbidden = i
                        lst[i] -= n
                        break
                for i in range(len(lst)):
                    if(i != forbidden):
                        lst[i] += 1
            print(n)
            print(' '.join([str(item) for item in lst]))
            return 0
main()

Submission Info

Submission Time
Task D - Decrease (Contestant ver.)
User antonych
Language Python3 (3.4.3)
Score 600
Code Size 750 Byte
Status
Exec Time 18 ms
Memory 3064 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 example0, example1, example2, example3, example4
All 600 / 600 corner0, corner1, corner2, corner3, corner4, corner5, corner6, corner7, corner8, corner9, example0, example1, example2, example3, example4, rand0, rand1, rand2, rand3, rand4, rand5, rand6, rand7, rand8, rand9
Case Name Status Exec Time Memory
corner0 18 ms 3064 KB
corner1 18 ms 3064 KB
corner2 18 ms 3064 KB
corner3 18 ms 3064 KB
corner4 18 ms 3064 KB
corner5 18 ms 3064 KB
corner6 18 ms 3064 KB
corner7 18 ms 3064 KB
corner8 18 ms 3064 KB
corner9 18 ms 3064 KB
example0 18 ms 3064 KB
example1 18 ms 3064 KB
example2 18 ms 3064 KB
example3 18 ms 3064 KB
example4 18 ms 3064 KB
rand0 18 ms 3064 KB
rand1 18 ms 3064 KB
rand2 18 ms 3064 KB
rand3 18 ms 3064 KB
rand4 18 ms 3064 KB
rand5 18 ms 3064 KB
rand6 18 ms 3064 KB
rand7 18 ms 3064 KB
rand8 18 ms 3064 KB
rand9 18 ms 3064 KB