結果
| 問題 | No.3808 Welcome to Mid Difficulty Problems |
| コンテスト | |
| ユーザー |
sepa38
|
| 提出日時 | 2026-09-21 10:32:58 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 402 ms / 2,000 ms |
| + 608µs | |
| コード長 | 651 bytes |
| 記録 | |
| コンパイル時間 | 1,503 ms |
| コンパイル使用メモリ | 63,784 KB |
| 実行使用メモリ | 143,476 KB |
| 最終ジャッジ日時 | 2026-11-20 20:51:24 |
| 合計ジャッジ時間 | 8,845 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
ソースコード
n, t = map(int, input().split())
d = dict()
for _ in range(n):
a, b = map(int, input().split())
if a in d:
d[a].append(b)
else:
d[a] = [b]
one = []
two = [] # 各ジャンルで一番時間のかからないものを 2 点とする
for ls in d.values():
ls.sort()
two.append(ls[0])
one += ls[1:]
one.sort()
two.sort()
# print(one, two)
oi = len(one) - 1
s = sum(one)
ans = 0
for i in range(len(two)):
s += two[i]
while s > t and oi >= 0:
s -= one[oi]
oi -= 1
c = (i + 1) * 2 + (oi + 1)
if oi >= -1 and s <= t:
ans = max(ans, c)
# print(i, oi, s, c)
print(ans)
sepa38