結果

問題 No.5 数字のブロック
ユーザー mkawa2mkawa2
提出日時 2020-01-15 08:48:39
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 879 bytes
コンパイル時間 543 ms
コンパイル使用メモリ 10,800 KB
実行使用メモリ 9,844 KB
最終ジャッジ日時 2023-08-29 04:04:23
合計ジャッジ時間 2,862 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,676 KB
testcase_01 AC 23 ms
8,668 KB
testcase_02 AC 21 ms
8,616 KB
testcase_03 AC 23 ms
9,352 KB
testcase_04 AC 22 ms
9,128 KB
testcase_05 AC 24 ms
9,636 KB
testcase_06 AC 22 ms
9,368 KB
testcase_07 AC 22 ms
9,256 KB
testcase_08 AC 23 ms
9,352 KB
testcase_09 AC 21 ms
8,992 KB
testcase_10 AC 24 ms
9,628 KB
testcase_11 AC 22 ms
9,096 KB
testcase_12 AC 23 ms
9,548 KB
testcase_13 AC 24 ms
9,608 KB
testcase_14 AC 20 ms
8,600 KB
testcase_15 AC 21 ms
8,732 KB
testcase_16 AC 24 ms
9,672 KB
testcase_17 AC 25 ms
9,844 KB
testcase_18 AC 25 ms
9,660 KB
testcase_19 AC 25 ms
9,772 KB
testcase_20 AC 20 ms
8,756 KB
testcase_21 AC 21 ms
8,780 KB
testcase_22 AC 20 ms
8,712 KB
testcase_23 AC 21 ms
8,668 KB
testcase_24 AC 20 ms
8,736 KB
testcase_25 AC 20 ms
8,848 KB
testcase_26 AC 20 ms
8,776 KB
testcase_27 AC 20 ms
8,664 KB
testcase_28 AC 21 ms
8,752 KB
testcase_29 AC 22 ms
9,076 KB
testcase_30 AC 21 ms
8,852 KB
testcase_31 AC 20 ms
8,792 KB
testcase_32 AC 20 ms
8,652 KB
testcase_33 AC 21 ms
8,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *


int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]

def main():
    l=II()
    n=II()
    ww=LI()
    ww.sort()
    s=0
    for i,w in enumerate(ww):
        s+=w
        if s>l:
            print(i)
            exit()
    print(n)
    
main()
0