結果

問題 No.1825 Except One
ユーザー とりゐとりゐ
提出日時 2021-12-23 03:28:40
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 339 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,864 KB
実行使用メモリ 76,096 KB
最終ジャッジ日時 2023-10-17 02:07:45
合計ジャッジ時間 5,594 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,536 KB
testcase_01 AC 36 ms
53,536 KB
testcase_02 AC 37 ms
53,536 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 1,228 ms
76,096 KB
testcase_06 AC 47 ms
62,592 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 37 ms
53,544 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 36 ms
53,544 KB
testcase_15 AC 37 ms
53,544 KB
testcase_16 AC 36 ms
53,544 KB
testcase_17 AC 36 ms
53,544 KB
testcase_18 AC 37 ms
53,544 KB
testcase_19 AC 36 ms
53,544 KB
testcase_20 AC 36 ms
53,544 KB
testcase_21 AC 37 ms
53,544 KB
testcase_22 AC 37 ms
53,544 KB
testcase_23 AC 36 ms
53,544 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 AC 53 ms
68,932 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 57 ms
68,976 KB
testcase_30 AC 60 ms
71,016 KB
testcase_31 AC 519 ms
76,088 KB
testcase_32 RE -
testcase_33 AC 51 ms
64,824 KB
testcase_34 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
if n>20:
  raise Exception

def popcount(n):
  return bin(n).count('1')

ans=0
for bit in range(1<<n):
  k=popcount(bit)
  if k<=1:
    continue
  b=[]
  for i in range(n):
    if (bit>>i)&1:
      b.append(a[i])
  mx=max(b)
  if sum(b)%(k-1)==0 and mx<=sum(b)//(k-1):
    ans+=1

print(ans)
0