結果

問題 No.2451 Redistribute Integers
ユーザー pitPpitP
提出日時 2023-09-01 21:41:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 174,492 KB
最終ジャッジ日時 2023-09-01 21:41:29
合計ジャッジ時間 4,382 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,272 KB
testcase_01 AC 71 ms
71,440 KB
testcase_02 AC 72 ms
71,320 KB
testcase_03 AC 72 ms
71,676 KB
testcase_04 AC 202 ms
159,088 KB
testcase_05 AC 68 ms
71,480 KB
testcase_06 AC 70 ms
71,148 KB
testcase_07 AC 71 ms
71,504 KB
testcase_08 AC 171 ms
149,248 KB
testcase_09 AC 70 ms
71,364 KB
testcase_10 AC 73 ms
75,168 KB
testcase_11 AC 73 ms
75,152 KB
testcase_12 AC 114 ms
102,068 KB
testcase_13 AC 195 ms
174,492 KB
testcase_14 AC 198 ms
158,600 KB
testcase_15 AC 135 ms
113,224 KB
testcase_16 AC 126 ms
104,992 KB
testcase_17 AC 166 ms
133,112 KB
testcase_18 AC 178 ms
146,084 KB
testcase_19 AC 86 ms
81,152 KB
testcase_20 AC 158 ms
136,948 KB
testcase_21 AC 186 ms
165,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
if sum(A) % N :
    exit(print("No"))

avg = sum(A) // N
S = - 1 << 60
for i in range(N):
    S = max(S, avg - A[i])

b = [0] * N
for i in range(N):
    b[i] = (A[i] + S - avg) // N
if sum(b) == S:
    print("Yes")
else:
    print("No")
0