結果

問題 No.54 Happy Hallowe'en
ユーザー Ricky_pon
提出日時 2020-05-22 10:10:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 61 ms / 5,000 ms
コード長 275 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-10-04 02:15:57
合計ジャッジ時間 1,757 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

n = int(readline())
m = map(int, read().split())
p = sorted(zip(m, m), key=lambda x: sum(x))
S = 1
for x in p:
    T = S & (1<<x[1])-1
    S |= T << x[0]
print(S.bit_length() - 1)
0