結果

問題 No.2918 Divide Applicants Fairly
ユーザー 高橋ゆに高橋ゆに
提出日時 2024-09-17 09:12:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 633 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 277,000 KB
最終ジャッジ日時 2024-10-07 11:30:50
合計ジャッジ時間 5,698 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
60,812 KB
testcase_01 AC 34 ms
52,524 KB
testcase_02 AC 33 ms
53,572 KB
testcase_03 AC 33 ms
51,940 KB
testcase_04 AC 36 ms
52,552 KB
testcase_05 AC 45 ms
60,568 KB
testcase_06 AC 44 ms
60,428 KB
testcase_07 AC 38 ms
52,480 KB
testcase_08 AC 35 ms
53,636 KB
testcase_09 AC 171 ms
79,496 KB
testcase_10 AC 36 ms
53,744 KB
testcase_11 AC 35 ms
52,696 KB
testcase_12 AC 110 ms
77,976 KB
testcase_13 AC 49 ms
64,156 KB
testcase_14 AC 43 ms
61,964 KB
testcase_15 AC 35 ms
52,548 KB
testcase_16 AC 36 ms
53,352 KB
testcase_17 AC 113 ms
77,612 KB
testcase_18 AC 35 ms
52,080 KB
testcase_19 AC 37 ms
52,320 KB
testcase_20 AC 35 ms
53,964 KB
testcase_21 AC 110 ms
77,324 KB
testcase_22 AC 36 ms
53,868 KB
testcase_23 AC 166 ms
79,572 KB
testcase_24 AC 35 ms
53,204 KB
testcase_25 AC 36 ms
52,080 KB
testcase_26 AC 45 ms
61,796 KB
testcase_27 TLE -
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 > 22:
    print(0)
    exit()

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

ans = 2 ** 60
for k in range(1, 11 + 1):
    combs[k].sort(key = lambda comb: rate_sums[comb])
    for i in range(len(combs[k]) - 1):
        ans = min(ans, abs(rate_sums[combs[k][i]] - rate_sums[combs[k][i + 1]]))
print(ans)
0