結果
| 問題 |
No.1238 選抜クラス
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-12-04 22:31:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,053 ms / 2,000 ms |
| コード長 | 542 bytes |
| コンパイル時間 | 309 ms |
| コンパイル使用メモリ | 82,396 KB |
| 実行使用メモリ | 131,168 KB |
| 最終ジャッジ日時 | 2024-12-04 22:31:59 |
| 合計ジャッジ時間 | 6,291 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 36 |
ソースコード
from collections import defaultdict
MOD = 10 ** 9 + 7
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
dic = defaultdict(int)
dic[(0, 0)] = 1
ans = 0
for i, a in enumerate(A):
tmp = pow(2, N - i - 1, MOD)
for (x, y), v in list(dic.items()):
if y + a >= K * (x + 1):
ans += v * tmp
ans %= MOD
elif y + a + 100 * (N - i - 1) < K * (x + N - i):
continue
else:
dic[(x + 1, y + a)] += v
dic[(x + 1, y + a)] %= MOD
print(ans)
ntuda