Submission #13042367


Source Code Expand

Copy
import sys
def input(): return sys.stdin.readline().rstrip()
from itertools import product
def main():
    n,m,x=map(int,input().split())
    CA=[[int(_) for _ in input().split()] for i in range(n)]
    ans=10**10
    n_lis=list(product([True,False],repeat=n))
    for comb in n_lis:
        cunt=0
        A=[0]*m
        for i,ca in enumerate(CA):
            if comb[i]:
                cunt+=ca[0]
                for j,aa in enumerate(ca[1:]):
                    A[j]+=aa
        for a in A:
            if a<x:
                break
        else:
            ans=min(ans,cunt)
    if ans==10**10:
        print(-1)
    else:
        print(ans)

if __name__=='__main__':
    main()

Submission Info

Submission Time
Task C - Skill Up
User charter
Language Python (3.8.2)
Score 300
Code Size 714 Byte
Status
Exec Time 53 ms
Memory 9520 KB

Judge Result

Set Name Score / Max Score Test Cases
sample 0 / 0 sample01, sample02, sample03
All 300 / 300 border01, border02, border03, border04, hand01, hand02, hand03, hand04, hand05, large01, large02, large03, large04, large05, large06, large07, large08, random01, random02, random03, random04, sample01, sample02, sample03
Case Name Status Exec Time Memory
border01 34 ms 9344 KB
border02 50 ms 9460 KB
border03 33 ms 9048 KB
border04 53 ms 9340 KB
hand01 18 ms 8936 KB
hand02 18 ms 9104 KB
hand03 49 ms 9444 KB
hand04 33 ms 9336 KB
hand05 49 ms 9500 KB
large01 51 ms 9336 KB
large02 33 ms 9288 KB
large03 53 ms 9516 KB
large04 35 ms 9256 KB
large05 33 ms 9160 KB
large06 35 ms 9048 KB
large07 49 ms 9452 KB
large08 52 ms 9512 KB
random01 18 ms 8940 KB
random02 37 ms 9520 KB
random03 33 ms 9052 KB
random04 20 ms 8928 KB
sample01 20 ms 9232 KB
sample02 18 ms 9048 KB
sample03 20 ms 8928 KB