結果
| 問題 |
No.2918 Divide Applicants Fairly
|
| ユーザー |
|
| 提出日時 | 2024-11-01 22:14:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 393 ms / 2,000 ms |
| コード長 | 487 bytes |
| コンパイル時間 | 365 ms |
| コンパイル使用メモリ | 82,104 KB |
| 実行使用メモリ | 178,892 KB |
| 最終ジャッジ日時 | 2024-11-01 22:14:55 |
| 合計ジャッジ時間 | 11,026 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
n = int(input())
A = list(map(int, input().split()))
c = n // 2
ma = max(A) * c
tf = [False] * (ma + 1)
def dfs(i, tot, cnt):
if cnt == c:
if tf[tot]:
print(0)
exit()
tf[tot] = True
return
ma = cnt + n - i
if ma < c:
return
dfs(i + 1, tot + A[i], cnt + 1)
dfs(i + 1, tot, cnt)
dfs(0, 0, 0)
inds = [i for i in range(ma + 1) if tf[i]]
le = len(inds)
print(min(inds[i] - inds[i - 1] for i in range(1, le)))