結果

問題 No.2918 Divide Applicants Fairly
ユーザー 高橋ゆに高橋ゆに
提出日時 2024-09-23 19:19:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 608 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 116,864 KB
最終ジャッジ日時 2024-10-07 11:33:08
合計ジャッジ時間 12,689 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 39 ms
52,352 KB
testcase_02 WA -
testcase_03 AC 38 ms
51,968 KB
testcase_04 AC 38 ms
51,712 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 38 ms
51,968 KB
testcase_11 WA -
testcase_12 AC 52 ms
62,208 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 39 ms
52,352 KB
testcase_16 AC 38 ms
51,840 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 37 ms
52,096 KB
testcase_25 AC 1,714 ms
116,608 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 47 ms
61,312 KB
testcase_30 AC 37 ms
51,840 KB
testcase_31 AC 49 ms
61,824 KB
testcase_32 AC 38 ms
52,224 KB
testcase_33 AC 40 ms
52,480 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 38 ms
51,968 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 38 ms
52,096 KB
testcase_47 AC 39 ms
51,968 KB
testcase_48 WA -
testcase_49 AC 160 ms
79,160 KB
testcase_50 AC 39 ms
52,224 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 76 ms
66,688 KB
testcase_56 AC 76 ms
67,200 KB
testcase_57 AC 261 ms
81,792 KB
testcase_58 AC 75 ms
66,560 KB
testcase_59 AC 74 ms
66,432 KB
testcase_60 WA -
testcase_61 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial

N = int(input())

if N > 25:
    print(0)
    exit()

rates = list(map(int, input().split()))
rate_sums = list(range(factorial(N) // factorial(N // 2) // factorial(N - N // 2)))

i = 0
for comb in range(1, 1 << N):
    if comb.bit_count() != N // 2:
        continue
    
    rate_sum = 0
    for i in range(N):
        if (comb >> i) & 1: rate_sum += rates[i]
    rate_sums[i] = rate_sum
    i += 1
rate_sums.sort()

ans = 2 ** 30
for i in range(len(rate_sums) - 1):
    if ans > abs(rate_sums[i] - rate_sums[i + 1]):
        ans = abs(rate_sums[i] - rate_sums[i + 1])
print(ans)
0