Problem:


Score : 300 points

Problem

Takahashi, who is a novice in competitive programming, wants to learn M algorithms.
Initially, his understanding level of each of the M algorithms is 0.

Takahashi is visiting a bookstore, where he finds N books on algorithms.
The i-th book (1\leq i\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\leq j\leq M).
There is no other way to increase the understanding levels of the algorithms.

Takahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.

Constraints

All values in input are integers.

1\leq N, M\leq 12

1\leq X\leq 10^5

1\leq C_i \leq 10^5

0\leq A_{i, j} \leq 10^5

Input

Input is given from Standard Input in the following format:

N M X
C_1 A_{1,1} A_{1,2} \cdots A_{1,M}
C_2 A_{2,1} A_{2,2} \cdots A_{2,M}
\vdots
C_N A_{N,1} A_{N,2} \cdots A_{N,M}

Output

If the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.

Sample Input 1

3 3 10
60 2 2 4
70 8 7 9
50 2 3 9

Sample Output 1

120

Buying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.

Sample Input 2

3 3 10
100 3 1 4
100 1 5 9
100 2 6 5

Sample Output 2

-1

Buying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.

Sample Input 3

8 5 22
100 3 7 5 3 1
164 4 5 2 7 8
334 7 2 7 2 9
234 4 7 2 8 2
541 5 4 3 3 6
235 4 8 6 9 7
394 3 6 1 6 2
872 8 4 3 7 2

Sample Output 3

1067



Sample input:
3 3 10
60 2 2 4
70 8 7 9
50 2 3 9


Sample output:
120

Submission status: Wrong Answer

Solution code:
N ,M, X = list(map(int,input().split()))
C = []
A = []
for i in range(N):
    B  = list(map(int, input().split()))
    C.append(B[0])
    A.append(B[1:])

result = [0 for i in range(2**N)]

money =[]
for i in range(2** N):
        tmp=[]
        for j in range(N):
            if ((i>>j)&1):
                tmp.append(C[j])
        money.append(sum(tmp))

for k in range(M):
    for i in range(2** N):
        tmp=[]
        for j in range(N):
            if ((i>>j)&1):
                tmp.append(A[j][0])
        if sum(tmp) >= X:
            result[i] +=1
book_price =[]
for i in range(len(result)):
    if result[i] == M:
        book_price.append(money[i])

if book_price:
    print(min(book_price))
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
from numba import njit
import numpy as np


def main(N, M, X, C):
    min = 10000000000000
    for i in range(N*N):
        a = np.zeros(N)
        cost = 0
        for j in range(N):
            a[j] = (i//(2**j)) % 2
            if a[j] == 1:
                cost += C[j][0]
        for l in range(M):
            sum = 0
            for k in range(N):
                if a[k] == 1:
                    sum += C[k][l+1]
            if sum < X:
                break
            if l == M-1:
                if cost <= min:
                    min = cost
    return min


N, M, X = map(int, input().split())
C = [list(map(int, input().split()))for _ in range(N)]
ans = main(N, M, X, C)
if ans == 10000000000000:
    ans = -1
print(ans)

Submission status: Wrong Answer

Solution code:
n,m,x = map(int,input().split())
book = [list(map(int, input().split())) for _ in range(n)]
cos_min=10**10
for i in range(1,2**n):
    s_c= [0]*(m+1)
    choose = bin(i).zfill(n)

    for j in range(n):
        if choose[n-j-1]=="1":  
            s_c = [a+b for (a,b)in zip(s_c,book[j])]

    for j in s_c[1:]:
        if j<x:
            break
    else:
        cos_min=min(cos_min,s_c[0])

if cos_min!=10**10 :
    print(cos_min)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n, m, x = map(int, input().split())
book = [list(map(int, input().split())) for _ in range(n)]
choose = 1
cost_min = 10000000 * n
for i in range(2 ** n - 1):
    a_list = [0] * (m + 1)
    c = bin(choose)[2:].zfill(n)

    for j in range(n):
        if c[n - j - 1] == '1':
            a_list = [x + y for (x, y) in zip(a_list, book[j])]
    choose += 1

    for k in a_list:
        if k < x:
            break
    else:
        cost_min = min(cost_min, a_list[0])
if cost_min != 10000000 * n:
    print(cost_min)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n, m, x = map(int, input().split())
book = [list(map(int, input().split())) for _ in range(n)]
choose = 1
cost_min = 1000000 * n
for i in range(2 ** n - 1):
    a_list = [0] * (m + 1)
    c = bin(choose)[2:].zfill(n)

    for j in range(n):
        if c[n - j - 1] == '1':
            a_list = [x + y for (x, y) in zip(a_list, book[j])]
    choose += 1

    for k in a_list:
        if k < x:
            break
    else:
        cost = a_list[0]
        cost_min = min(cost_min, cost)
if cost_min != 1000000 * n:
    print(cost_min)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n, m, x = map(int, input().split())
book = [list(map(int, input().split())) for _ in range(n)]
choose = 1
cost_min = 1000000 * n
for i in range(2 ** n - 1):
    a_list = [0] * (m + 1)
    c = bin(choose)[2:].zfill(n)

    for j in range(n):
        if c[n - j - 1] == '1':
            a_list = [x + y for (x, y) in zip(a_list, book[j])]
    choose += 1

    for k in a_list:
        if k < x:
            break
    else:
        cost = a_list[0]
        cost_min = min(cost_min, cost)
if cost_min != 100000 * n:
    print(cost_min)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
n, m, x = map(int, input().split())
book = [list(map(int, input().split())) for _ in range(n)]
choose = 1
cost_min = 1000000 * n
for i in range(2 ** n - 1):
    a_list = [0] * (m + 1)
    c = bin(choose)[2:].zfill(n)
    for j in range(n):
        if c[n - j - 1] == '1':
            a_list = [x + y for (x, y) in zip(a_list, book[j])]
    choose += 1
    for k in a_list:
        if k < x:
            break
    else:
        cost = a_list[0]
        cost_min = min(cost_min, cost)
print(cost_min)

Submission status: Wrong Answer

Solution code:
n, m, x = map(int, input().split())
book = [list(map(int, input().split())) for _ in range(n)]
choose = 1
cost_min = 1000000 * n
for i in range(2 ** n - 1):
    a_list = [0] * (m + 1)
    c = bin(choose)[2:].zfill(n)
    for j in range(n):
        if c[n - j - 1] == '1':
            a_list = [x + y for (x, y) in zip(a_list, book[j])]
    choose += 1
    print(a_list)
    for k in a_list:
        if k < x:
            break
    else:
        cost = a_list[0]
        cost_min = min(cost_min, cost)
print(cost_min)

Submission status: Wrong Answer

Solution code:
INF=100050

N,M,X=map(int,input().split())

A=[]
C=[]
for i in range(N):
    array=list(map(int,input().split()))
    C.append(array[0])
    A.append(array[1:])

combination=[i for i in range(2**N)]

min_price=INF

for i in range(2**N):
    price=0
    knowledge=[0 for i in range(M)]
    for j in range(N):
        if combination[i]%(2**(j+1)):
            price+=C[j]
            for k in range(M):
                knowledge[k]+=A[j][k]
            combination[i]-=2**j
    if min(knowledge)>=X:
        min_price=min(min_price,price)

if min_price==INF:
    print("-1")
else:
    print(min_price)

Submission status: Wrong Answer

Solution code:
n,m,x = map(int, input().split())
c, a = [0]*n, [0]*n
d = dict()
for i in range(n):
    c[i],*a[i] = map(int, input().split())
for i in range(n):
    d[c[i]] = a[i]
c.sort()
b = [[d[j][i] for j in c] for i in range(m)]

s = [sum(i) for i in b]
n = 0
if min(s) < x:
    print(-1)
    exit()
while n < len(c):
    mind = len(c)-n-1
    for i in range(m):
        s[i] = s[i] - b[i][mind]
    if min(s) < x:
        n += 1
    else:
        for i in b:
            del i[mind]
        del c[mind]
    s = [sum(i) for i in b]
print(sum(c))

Submission status: Wrong Answer

Solution code:
n,m,x = map(int, input().split())
c, a = [0]*n, [0]*n
for i in range(n):
    c[i],*a[i] = map(int, input().split())

b = [[a[j][i] for j in range(n)] for i in range(m)]
s = [sum(i) for i in b]
if min(s) < x:
    print(-1)
    exit()
while min(s) >= x:
    mind = c.index(max(c))
    for i in b:
        del i[mind]
    p = c[mind]
    del c[mind]
    s = [sum(i) for i in b]
print(sum(c) + p)

Submission status: Wrong Answer

Solution code:
N, M, X = map(int, input().split())
C = []
A = []
result = -1

for i in range(N):
    tmp = list(map(int, input().split()))
    C.append(tmp[0])
    A.append(tmp[1:])

for n in range(1 << N-1):
    Cn = 0
    skill = [0] * M
    for i in range(N):
        if (n >> i) & 1 == 1:
            Cn += C[i]
            for j in range(M):
                skill[j] += A[i][j]

    if all(x >= X for x in skill):
        if result == -1:
            result = Cn
        else:
            result = min(result, Cn)

print(result)

Submission status: Wrong Answer

Solution code:
n, m, x = map(int, input().split(' '))
input_lists = [list(map(int, input().split(' '))) for _ in range(n)]

comb = []
for i in range(2 ** n):
    tmp = []
    for j in range(n):
        if ((i >> j) & 1):
            tmp.append(input_lists[j])
    comb.append(tmp)

result = -1
for i in range(len(comb)):
    understand = [0]*(m+1)
    for j in range(len(comb[i])):
        for k in range(m+1):
            understand[k] += comb[i][j][k]

    if understand[1:m+1] >= [x]*m:
        if result == -1 or result > understand[0]:
            result = understand[0]

print(result)

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(1 << N):
    total = [0]*(M+1)
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    # print(total)
    if all( k >= X for k in total) == True:
        if ans == -1:
            ans = total[0]
        else:
            ans = min(ans,total[0]) 
print(ans)

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(2 ** N):
    total = [0]*(M+3)
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    # print(total)
    if all( k >= X for k in total) == True:
        if ans == -1:
            ans = total[0]
        else:
            ans = min(ans,total[0]) 
print(ans)

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(2 ** N):
    total = [0]*(M+1)
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    # print(total)
    if all( k >= X for k in total) == True:
        if ans == -1:
            ans = total[0]
        else:
            ans = min(ans,total[0]) 
print(ans)

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(2 ** N):
    total = [0]*(M+1)
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    if all( k >= X for k in total) == True:
        if ans == -1:
            ans = total[0]
        else:
            ans = min(ans,total[0]) 
print(ans)

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(2 ** N):
    total = [0]*M
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    if all( k >= X for k in total) == True:
        if ans == -1:
            ans = total[0]
        else:
            ans = min(ans,total[0]) 
print(ans)

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = -1
for i in range(2 ** N):
    total = [0 for _ in range(M)]
    for j in range(N):  
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    if all( k >= X for k in total) == True:
        if ans == -1:
            ans = total[0]
        else:
            ans = min(ans,total[0]) 
print(ans)

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = []
for i in range(2 ** N):
    total = [0 for _ in range(M)]
    for j in range(N):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    if all( k >= X for k in total) == True:
       ans.append(total[0])
    # print(total)
if len(ans) == 0:
    print(-1)
else:
    print(min(ans))

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = [-1]
for i in range(2 ** N):
    total = [0 for _ in range(M)]
    for j in range(N):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            total = [x + y for (x, y) in zip(total, items[j])]
    if all( k >= X for k in total) == True:
        if ans[0] == -1 or ans[0] > total[0]:
            ans = total
    # print(total)
print(ans[0])

Submission status: Wrong Answer

Solution code:
# bit全探索問題

N,M,X = map(int,input().split())
items = [list(map(int,input().split())) for _ in range(N)]
ans = [-1]
for i in range(2 ** N):
    bag = []
    total = [0 for _ in range(M)]
    for j in range(N):  # このループが一番のポイント
        if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
            bag.append(items[j][0])  # フラグが立っていたら bag に果物を詰める
            total = [x + y for (x, y) in zip(total, items[j])]
    if len([k for k in total if k < X ]) == 0:
        if ans[0] == -1 or ans[0] > total[0]:
            ans = total
    # print(total)
print(ans[0])

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys,itertools
input = sys.stdin.readline
N, M, X = map(int, input().split())
import numpy as np
c_ = []
for i in range(N):
  c_.append([int(a) for a in input().split()])

c = np.array(c_)[:,0]
ar = np.array(c_)[:,1:]
summ = np.sum(ar, axis=0)
# print(summ<X)
if any(summ<X):
  print('-1')
  sys.exit()
  
subsets = []
lis = list(range(0,N))
for i in range(len(lis)):
  for j in itertools.combinations(lis, i):
    subsets.append(list(j))
mini = np.sum(c[subsets[-1]])
for i in subsets:
  if np.all(np.sum(ar[i],axis=0)>=X):
    money = np.sum(c[i])
    if money<mini:
      mini = money
print(mini)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, M, X = list(map(int, input().split()))
CA = []
A = []
for _ in range(n):
    L = list(map(int, input().split()))
    CA.append(L[:])
ans = np.zeros(M+1)
 
S = [0]*n
ANS = list()
def makeCombination():
    for i in range(0, n-1):
        S[i] = 0
    rec(0, ans)
def rec(i,ans):
    if i == n:
        if all(ans[1:] >= X) == True:
            ANS.append(ans[0])
        return
    rec(i + 1,ans)
    S[i] = 1
    ans = ans   + np.array(CA[i])
    rec(i + 1, ans)
    S[i] = 0
makeCombination()
ANS.sort()
if len(ANS) >= 1:
    print(ANS[0])
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil, factorial, log,tan,pi,cos,sin,radians
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
from fractions import Fraction
from functools import reduce
import string
import sys
import os
import re
inf = float('inf')
mod_ = int(1e9) + 7
mod = 998244353

def factors(n):
    from functools import reduce
    return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0)))

def sieve(m):
    n=1
    primes = {}
    arr=set([])
    for i in range(2, int(m ** 0.5) + 1):
        a = n // i
        b = m // i
        for k in range(max(2, a), b + 1):
            c = i * k
            primes[c] = 1

    for i in range(max(n, 2), m + 1):
        if i not in primes:
            arr.add(i)

    return arr


class DisjointSetUnion:
    def __init__(self, n):
        self.parent = list(range(n))
        self.size = [1] * n
        self.num_sets = n
 
    def find(self, a):
        acopy = a
        while a != self.parent[a]:
            a = self.parent[a]
        while acopy != a:
            self.parent[acopy], acopy = a, self.parent[acopy]
        return a
 
    def union(self, a, b):
        a, b = self.find(a), self.find(b)
        if a != b:
            if self.size[a] < self.size[b]:
                a, b = b, a
 
            self.num_sets -= 1
            self.parent[b] = a
            self.size[a] += self.size[b]
 
    def set_size(self, a):
        return self.size[self.find(a)]
 
    def __len__(self):
        return self.num_sets

def isprime(t):
    for i in range(2,int(t**0.5)+1):
        if t%i==0:
            return False
    return True
def semiprime(x):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            if isprime(i) and isprime(x//i) and i!=x//i:
                return True
    return False



def main():
    n,m,x=map(int,input().split())
    arr=[]
    for i in range(n):
        book=list(map(int,input().split()))
        arr.append(book)
    # dest=[0]*m
    ans=[]
    for i in range(2**n):
        dest=[0]*(m+1)
        for j in range(n):
            if (i>>j)&1:
                for k in range(len(dest)):
                    dest[k]+=arr[j][k]
        # print(dest)
        if all(i>=x for i in dest):
            ans.append(dest[0])
    if len(ans)==0:
        print(-1)
    else:
        print(min(ans))




        

        
    




    



# region fastio

BUFSIZE = 8192

class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()


class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m,x = map(int,input().split())
info = []
for i in range(n):
    info.append(list(map(int,input().split())))
info = np.array(info)


money = np.sum(info, axis = 0)[0]
flag = 0
for i in range(2**n):
    tem = np.zeros(m+1)
    for j in range(n):
        if ((i >> j) & 1):
            tem += info[j]
    skill = tem[1:]
    non = np.all(skill >= x)
    if non:
        flag = 1
        if tem[0] < money:
            money = tem[0]
    else:
      continue

if flag == 0:
    print(-1)
else:
    print(money)

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m,x = map(int,input().split())
info = []
for i in range(n):
    info.append(list(map(int,input().split())))
info = np.array(info)


money = 10000000000
flag = 0
for i in range(2**n):
    tem = np.zeros(m+1)
    for j in range(n):
        if ((i >> j) & 1):
            tem += info[j]
    skill = tem[1:]
    non = np.all(skill >= x)
    if non:
        flag = 1
        if tem[0] < money:
            money = tem[0]

if flag == 0:
    print(-1)
else:
    print(money)

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m,x = map(int,input().split())
info = []
for i in range(n):
    info.append(list(map(int,input().split())))
info = np.array(info)


money = np.sum(info, axis = 0)[0]
flag = 0
for i in range(2**n):
    tem = np.zeros(m+1)
    for j in range(n):
        if ((i >> j) & 1):
            tem += info[j]
    skill = tem[1:]
    non = np.all(skill >= x)
    if non:
        flag = 1
        if tem[0] < money:
            money = tem[0]

if flag == 0:
    print(-1)
else:
    print(money)

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m,x = map(int,input().split())
info = []
for i in range(n):
    info.append(list(map(int,input().split())))
info = np.array(info)


money = np.sum(info, axis = 0)[0]
flag = 0
for i in range(2**n):
    tem = np.zeros(m+1)
    for j in range(n):
        if ((i >> j) & 1):
            tem += info[j]
    skill = tem[1:]
    non = np.any(skill < x)
    if non == False:
        flag = 1
        if tem[0] < money:
            money = tem[0]

if flag == 0:
    print(-1)
else:
    print(money)

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m,x = map(int,input().split())
info = []
for i in range(n):
    info.append(list(map(int,input().split())))
info = np.array(info)

money = np.sum(info, axis = 0)[0]
flag = 0
for i in range(2**n):
    tem = np.zeros(m+1)
    for j in range(n):
        if ((i >> j) & 1):
            tem += info[j]

    non = np.any(tem[1:] < x)
    if non == False:
        flag = 1
        if tem[0] < money:
            money = tem[0]

if flag == 0:
    print(-1)
else:
    print(money)

Submission status: Wrong Answer

Solution code:
import numpy as np
n,m,x = map(int,input().split())
info = []
for i in range(n):
    info.append(list(map(int,input().split())))
info = np.array(info)

money = np.sum(info, axis = 0)[0]
flag = 0
for i in range(2**n):
    tem = np.zeros(m+1)
    for j in range(n):
        if (i >> j) & 1:
            tem += info[j]
    non = np.any(tem < 10)
    if non == False:
        flag = 1
        if tem[0] < money:
            money = tem[0]

if flag == 0:
    print(-1)
else:
    print(money)

Submission status: Wrong Answer

Solution code:
import numpy as np

n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(1,2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):
            buy_list.append(understand_list[j])
            money += understand_list[j][0]

    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list]):
        money_list.append(buy_list[0])

if money_list == []:
    print(-1)
else:
    print(min(money_list))

Submission status: Wrong Answer

Solution code:
import numpy as np

n , m , x = map(int,input().split())
understand_list = [list(map(int,input().split()))]
for _ in range(n-1):
    understand_list.append(list(map(int,input().split())))

money_list = []
for i in range(2 ** n):
    buy_list = []
    money = 0
    for j in range(n):
        if ((i >> j) & 1):
            buy_list.append(understand_list[j])
            money += understand_list[j][0]

    if buy_list == []:
        continue
    buy_list = np.sum(buy_list, axis=0)
    if all([i >= x for i in buy_list]):
        money_list.append(buy_list[0])

if money_list == []:
    print(-1)
else:
    print(min(money_list))

Submission status: Wrong Answer

Solution code:
from itertools import combinations
N, M, X = [int(i) for i in input().split()]
lines = [input().split() for i in range(N)]
flag = False
prices = []
for num_books in range(1, N + 1):
    for combo in combinations(lines, num_books):
        price = 0
        skills = [0 for i in range(M)]
        for book in combo:
            price += int(book[0])
            for ind, skill in enumerate(book[1:]):
                skills[ind] += int(skill)
        if not [i for i in skills if i < X]:
            flag = True
            prices.append(price)
            break
if not flag:
    print(-1)
else:
    print(min(prices))

Submission status: Wrong Answer

Solution code:
from itertools import combinations
N, M, X = [int(i) for i in input().split()]
lines = [input().split() for i in range(N)]
flag = False
for num_books in range(1, N + 1):
    for combo in combinations(lines, num_books):
        price = 0
        skills = [0 for i in range(M)]
        for book in combo:
            price += int(book[0])
            for ind, skill in enumerate(book[1:]):
                skills[ind] += int(skill)
        if not [i for i in skills if i < X]:
            flag = True
            print(price)
            break
    if flag:
        break
if not flag:
    print(-1)

Submission status: Wrong Answer

Solution code:
n,m,x=map(int,input().split())
li=[0]*(m+1)
k=[]
for i in range(n):
    c=list(map(int,input().split()))
    li=li+c
    a=li.pop(0)
    k.append(a)
if min(li)>=x:
    print(sum(k))
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
n,m,x=map(int,input().split())
li=[0]*(m+1)
k=[]
for i in range(n):
    c=list(map(int,input().split()))
    li=li+c
    a=li.pop(0)
    k.append(a)
if min(li)>=x:
    print(k)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
n,m,x=map(int,input().split())
li=[0]*(m+1)
for i in range(n):
    c=list(map(int,input().split()))
    li=li+c
k=li.pop(0)
if min(li)>=x:
    print(k)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
n,m,x=map(int,input().split())
li=[0]*(m+1)
for i in range(n):
    c=list(map(int,input().split()))
    nli=li+c
k=nli.pop(0)
if min(nli)>=x:
    print(k)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
n,m,x=map(int,input().split())
li=[0]*m
for i in range(n):
    c=list(map(int,input().split()))
    nli=li+c
k=nli.pop(0)
if min(nli)>=x:
    print(k)
else:
    print("-1")

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
sys.setrecursionlimit(10**8)

def dfs(i,a,value):
  global ans
  if i==n:
    if all(a[i]>=x for i in range(m)):
      ans=min(ans,value)

    else:
      ans=-1

  else:
    dfs(i+1,a,value)
    dfs(i+1,a+np.array(pc[i][1:]),value+pc[i][0])


ans=float('inf')
n,m,x=map(int,input().split())
pc=[]
for i in range(n):
  s=list(map(int,input().split()))
  pc.append(s)

dfs(0,np.array([0]*(m)),0)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np
n, m, x = list(map(int, input().split()))
c = []
a = []
price = 0
m_achive = [0 for _ in range(m)]
for i in sys.stdin:
  temp = list(map(int, i.split()))
  c.append(temp[0])
  a.append(list(temp[1:])) 

array = np.array(a).transpose()

if(sum(array[0])>x):
  sorted(array[0], reverse=True)
else:
  print('-1')

Submission status: Wrong Answer

Solution code:
import numpy as np
import itertools
N, M, X = map(int, input().split())
kumi = []
pat = list(range(N))
for _ in range(N):
    kumi.append(list(map(int, input().split())))
ans = 10 ** 5 * 12
kai = False
test = []
for i in range(N):
    for i2 in itertools.combinations(kumi,i+1):
        arr_i2 = np.array(i2)
        arr_i2_sum = arr_i2.sum(axis = 0)
        if np.all(arr_i2_sum[1:] >= X):
            if ans > arr_i2_sum[0]:
                ans = arr_i2_sum[0]
                kai = True
if kai:
    print(ans)
else:
    print(-1)

Submission status: Wrong Answer

Solution code:
import numpy as np
import itertools
N, M, X = map(int, input().split())
kumi = []
pat = list(range(N))
for _ in range(N):
    kumi.append(list(map(int, input().split())))
ans0 = 10 ** 5 * 12
ans = 10 ** 5 * 12
#print(kumi)
test = []
for i in range(N):
    for i2 in itertools.combinations(kumi,i+1):
        arr_i2 = np.array(i2)
        arr_i2_sum = arr_i2.sum(axis = 0)
        if np.all(arr_i2_sum[1:] >= X):
            if ans > arr_i2_sum[0]:
                ans = arr_i2_sum[0]
if ans == ans0:
    print(-1)
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys
N, M, X=map(int, sys.stdin.readline().rstrip().split())
A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)]
cost=[]
for i in range(1<<N):	#Bit All Search
	l=[0]*(M+1)
	for j in range(N):
		if((i>>j)&1)==1:
			l=[l[k]+A[j][k] for k in range(M+1)]
	for k in range(M):
		if l[k+1]<X:
			break
		else:
			cost.append(l[0])
cost.sort()
print(-1 if cost==[] else cost[0])

Submission status: Wrong Answer

Solution code:
import sys
N, M, X=map(int, sys.stdin.readline().rstrip().split())
A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)]
cost=[]
for i in range(1<<N):	#Bit All Search
	l=[0]*(M+1)
	for j in range(N):
		if((i>>j)&1)==1:
			l=[l[k]+A[j][k] for k in range(M+1)]
	for k in range(M):
		if l[k+1]<X:break
		else:cost.append(l[0])
cost.sort()
print(-1 if cost==[] else cost[0])

Submission status: Wrong Answer

Solution code:
import sys

N, M, X=map(int, sys.stdin.readline().rstrip().split())
A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)]
cost=[]

for i in range(1<<N):	#Bit All Search
	l=[0]*(M+1)
	for j in range(N):
		if((i>>j)&1):
			l=[l[k]+A[j][k] for k in range(M+1)]
	for k in range(M):
		if l[k+1]<X:
			break
		else:
			cost.append(l[0])
cost.sort()
print(-1 if cost==[] else cost[0])

Submission status: Wrong Answer

Solution code:
import sys

N, M, X=map(int, sys.stdin.readline().rstrip().split())
A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)]

cost=[]
for i in range(N**2):	#Bit All Search
	l=[0]*(M+1)
	for j in range(N):
		if((i>>j)&1):
			l=[l[k]+A[j][k] for k in range(M+1)]
	for k in range(M):
		if l[k+1]<X:break
		else:
			cost.append(l[0])
cost.sort()
print(-1 if cost==[] else cost[0])

Submission status: Wrong Answer

Solution code:
import sys

n, m, x=map(int, sys.stdin.readline().rstrip().split())

ca=[]
cost=-1
#読み込み
for i in range(n):
	ca.append(list(map(int, sys.stdin.readline().rstrip().split())))
    
for i in range(n**2):	#Bit All Search
	l=[0 for i in range(m+1)]
	for j in range(n):
		if((i>>j)&1):
			for k in range(m+1):
				l[k]+=ca[j][k]
	check=True
	for k in range(1,m+1):
		if l[k]<x:check=False
	if check:
		if cost==-1 or cost>l[0]:cost=l[0]
print(cost)