結果

問題 No.54 Happy Hallowe'en
ユーザー 👑 colognecologne
提出日時 2022-01-24 20:28:13
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 457 bytes
コンパイル時間 846 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 78,336 KB
最終ジャッジ日時 2024-05-08 17:02:12
合計ジャッジ時間 3,138 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
57,344 KB
testcase_01 AC 43 ms
57,344 KB
testcase_02 AC 42 ms
56,960 KB
testcase_03 AC 43 ms
56,960 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 43 ms
56,832 KB
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 41 ms
56,704 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys


def input(): return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    VT = [list(map(int, input().split())) for i in range(N)]
    VT.sort(key=sum)

    a = [True] + [False] * 2000
    for v, t in VT:
        for i in range(t-1, -1, -1):
            if a[i]:
                a[i+v] = True

    for i in range(len(a)-1, -1, -1):
        if a[i]:
            print(i)
            return


if __name__ == '__main__':
    main()
0