結果
| 問題 | No.2918 Divide Applicants Fairly |
| ユーザー |
高橋ゆに
|
| 提出日時 | 2024-09-24 17:37:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 492 bytes |
| 記録 | |
| コンパイル時間 | 545 ms |
| コンパイル使用メモリ | 82,580 KB |
| 実行使用メモリ | 247,356 KB |
| 最終ジャッジ日時 | 2024-10-07 11:33:20 |
| 合計ジャッジ時間 | 13,709 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 WA * 26 |
ソースコード
N = int(input())
if N > 25:
print(0)
exit()
rates = list(map(int, input().split()))
rates.sort()
rate_sums = []
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.append(rate_sum)
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)
高橋ゆに