Submission #1466601


Source Code Expand

#!/usr/bin/env python
# -*- coding: utf-8 -*-
def main():
  N = int(raw_input())
  A = map(lambda s: int(s) - N + 1, raw_input().split())
  K = 0
  while True:
    c = []
    for i in xrange(N):
      if A[i] > 0:
        c.append(i)
    if not c:
      break
    s = 0
    for i in c:
      k = (A[i] + (N - 1)) / N
      A[i] -= k * (N + 1)
      s += k
    for i in xrange(N):
      A[i] += s
    K += s
  print K

main()

Submission Info

Submission Time
Task E - Decrease (Judge ver.)
User arosusti
Language PyPy2 (5.6.0)
Score 600
Code Size 447 Byte
Status AC
Exec Time 57 ms
Memory 32620 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 5
AC × 35
Set Name Test Cases
Sample example0, example1, example2, example3, example4
All example0, example1, example2, example3, example4, maxrand0, maxrand1, maxrand2, maxrand3, maxrand4, maxrand5, maxrand6, maxrand7, maxrand8, maxrand9, rand0, rand1, rand2, rand3, rand4, rand5, rand6, rand7, rand8, rand9, small0, small1, small2, small3, small4, small5, small6, small7, small8, small9
Case Name Status Exec Time Memory
example0 AC 35 ms 28524 KiB
example1 AC 33 ms 26476 KiB
example2 AC 34 ms 28012 KiB
example3 AC 34 ms 26988 KiB
example4 AC 48 ms 29932 KiB
maxrand0 AC 34 ms 26860 KiB
maxrand1 AC 51 ms 32492 KiB
maxrand2 AC 34 ms 27116 KiB
maxrand3 AC 57 ms 32412 KiB
maxrand4 AC 36 ms 26860 KiB
maxrand5 AC 56 ms 32412 KiB
maxrand6 AC 35 ms 26860 KiB
maxrand7 AC 53 ms 32620 KiB
maxrand8 AC 39 ms 29292 KiB
maxrand9 AC 51 ms 32364 KiB
rand0 AC 41 ms 30188 KiB
rand1 AC 49 ms 32492 KiB
rand2 AC 49 ms 32364 KiB
rand3 AC 57 ms 32412 KiB
rand4 AC 49 ms 32620 KiB
rand5 AC 49 ms 32620 KiB
rand6 AC 48 ms 32236 KiB
rand7 AC 50 ms 32620 KiB
rand8 AC 44 ms 30700 KiB
rand9 AC 49 ms 32492 KiB
small0 AC 34 ms 26988 KiB
small1 AC 34 ms 26476 KiB
small2 AC 34 ms 26476 KiB
small3 AC 34 ms 27756 KiB
small4 AC 39 ms 29164 KiB
small5 AC 40 ms 29676 KiB
small6 AC 39 ms 30060 KiB
small7 AC 34 ms 26988 KiB
small8 AC 38 ms 29164 KiB
small9 AC 41 ms 29804 KiB