結果

問題 No.2918 Divide Applicants Fairly
ユーザー 高橋ゆに高橋ゆに
提出日時 2024-09-20 12:23:19
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 588 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 309,636 KB
最終ジャッジ日時 2024-10-07 11:32:03
合計ジャッジ時間 4,382 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
59,196 KB
testcase_01 AC 38 ms
52,432 KB
testcase_02 AC 37 ms
52,524 KB
testcase_03 AC 38 ms
53,220 KB
testcase_04 AC 36 ms
53,012 KB
testcase_05 AC 44 ms
60,212 KB
testcase_06 AC 44 ms
61,124 KB
testcase_07 AC 39 ms
52,680 KB
testcase_08 AC 38 ms
53,072 KB
testcase_09 AC 103 ms
78,080 KB
testcase_10 AC 38 ms
52,924 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

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

rates = list(map(int, input().split()))
rate_sums = [[] for k in range(12)]
for comb in range(1, 1 << N):
    if comb.bit_count() > 12:
        continue
    
    rate_sum = 0
    for i in range(N):
        if (comb >> i) & 1: rate_sum += rates[i]
    rate_sums[comb.bit_count() - 1].append(rate_sum)

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