提出 #31708193


ソースコード 拡げる

n, m, x = map(int, input().split())
a = [[]] * n
c = [0] * n
for i in range(n):
    a[i] = list(map(int, input().split()))
    c[i] = a[i][0]
    a[i] = a[i][1 :]
answer = 1000000000
for i in range(1 << n):
    understood = [0] * m
    cost = 0
    for j in range(n):
        if (i >> j) & 1 == 0:
            continue
        cost += c[j]
        for k in range(m):
            understood[k] += a[j][k]
    ok = 1
    for j in range(m):
        if understood[j] < x:
            ok = 0
    if ok == 1:
        answer = min(answer, cost)
if answer == 1000000000:
    print(-1)
else:
    print(answer)

提出情報

提出日時
問題 C - Skill Up
ユーザ Pro_ktmr
言語 PyPy3 (7.3.0)
得点 300
コード長 626 Byte
結果 AC
実行時間 91 ms
メモリ 73640 KiB

ジャッジ結果

セット名 sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 24
セット名 テストケース
sample sample01, sample02, sample03
All border01, border02, border03, border04, hand01, hand02, hand03, hand04, hand05, large01, large02, large03, large04, large05, large06, large07, large08, random01, random02, random03, random04, sample01, sample02, sample03
ケース名 結果 実行時間 メモリ
border01 AC 91 ms 73260 KiB
border02 AC 71 ms 73308 KiB
border03 AC 72 ms 73032 KiB
border04 AC 76 ms 73640 KiB
hand01 AC 54 ms 61380 KiB
hand02 AC 54 ms 61500 KiB
hand03 AC 74 ms 73552 KiB
hand04 AC 63 ms 67936 KiB
hand05 AC 75 ms 73240 KiB
large01 AC 72 ms 73492 KiB
large02 AC 76 ms 73004 KiB
large03 AC 72 ms 73328 KiB
large04 AC 72 ms 73292 KiB
large05 AC 73 ms 73480 KiB
large06 AC 73 ms 73180 KiB
large07 AC 85 ms 73624 KiB
large08 AC 74 ms 73192 KiB
random01 AC 51 ms 61564 KiB
random02 AC 78 ms 73612 KiB
random03 AC 66 ms 71136 KiB
random04 AC 47 ms 61696 KiB
sample01 AC 54 ms 61520 KiB
sample02 AC 51 ms 61464 KiB
sample03 AC 64 ms 67036 KiB