結果
| 問題 | No.3808 Welcome to Mid Difficulty Problems |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-20 22:19:03 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 509 ms / 2,000 ms |
| + 13µs | |
| コード長 | 817 bytes |
| 記録 | |
| コンパイル時間 | 1,263 ms |
| コンパイル使用メモリ | 64,248 KB |
| 実行使用メモリ | 158,984 KB |
| 最終ジャッジ日時 | 2026-11-20 22:19:18 |
| 合計ジャッジ時間 | 8,355 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 28 |
ソースコード
# https://github.com/robe2222555/atcoder-lib/blob/main/template/python/main.py import sys input = lambda: sys.stdin.readline().rstrip() def LI(): return list(map(int, input().split())) def II(): return int(input()) INF = 1<<60 def solve(): N,T = LI() init = [] other = [] Item = [LI() for _ in range(N)] Item.sort(key=lambda x:x[1]) visit = [0]*(N+1) for a,b in Item: if not visit[a]: init.append(b) visit[a] = 1 else: other.append(b) ans = 0 acc = sum(other) r = len(other)-1 while acc>T: acc -= other[r] r -= 1 ans = max(ans, r+1) for l in range(len(init)): T -= init[l] if T<0: break while acc>T: acc -= other[r] r -= 1 ans = max(ans, r+1 + (l+1)*2) print(ans) return def main(): T = 1 for _ in range(T): solve() return if __name__ == '__main__': main()