buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
import numpy as np n,m,x = map(int, input().split()) s_list = list() for i in range(n): line = list(map(int, input().split())) s_list.append([line[0], np.array(line[1:], dtype=int)]) cands = list() # cost, value cands.append([0, np.zeros(m, dtype=int)]) for l in s_list: next_cands = list() for...
import numpy as np n,m,x = map(int, input().split()) s_list = list() for i in range(n): line = list(map(int, input().split())) s_list.append([line[0], np.array(line[1:], dtype=int)]) cands = list() # cost, value cands.append([0, np.zeros(m, dtype=int)]) for l in s_list: next_cands = list() for...
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
202
def main(): IN1 = [int(_) for _ in input().split()] N = IN1[0] M = IN1[1] X = IN1[2] AC = [[int(_) for _ in input().split()] for i in range(N)] minSum = 100001 for i in range(2 ** N): tmpSum = 0 tmpA = [0] * M for j in range(N): if ((i >> j) & 1): ...
def main(): IN1 = [int(_) for _ in input().split()] N = IN1[0] M = IN1[1] X = IN1[2] AC = [[int(_) for _ in input().split()] for i in range(N)] minSum = 1200001 for i in range(2 ** N): tmpSum = 0 tmpA = [0] * M for j in range(N): if ((i >> j) & 1): ...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 1...
5
207
import itertools n, m, x = map(int, input().split()) ca = [list(int(i) for i in input().split()) for i in range(n)] cost_list = [] for choice in range(n): for v in itertools.combinations(ca, choice): cost = 0 us = [0] * m for t in v: cost += t[0] for i in range(m): us[i] += t[i+1] ...
import itertools n, m, x = map(int, input().split()) ca = [list(int(i) for i in input().split()) for i in range(n)] cost_list = [] for choice in range(n+1): for v in itertools.combinations(ca, choice): cost = 0 us = [0] * m for t in v: cost += t[0] for i in range(m): us[i] += t[i+1] ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
167
def solve(): N, M, X = map(int, input().split()) AC = [] ans = 10**8 for n in range(N): AC.append(list(map(int, input().split()))) for i in range(2**N): level = [0]*M cost = 0 for j in range(N): if ((i >> j) & 1): for l in range(M): ...
def solve(): N, M, X = map(int, input().split()) AC = [] ans = 10**8 for n in range(N): AC.append(list(map(int, input().split()))) for i in range(2**N): level = [0]*M cost = 0 for j in range(N): if ((i >> j) & 1): for l in range(M): ...
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
170
#include <stdio.h> int main() { int n, i, j, k, m, a[12][12], c[12], x, mm = 10000000, d[12], e; scanf("%d", &n); scanf("%d", &m); scanf("%d", &x); for (i = 0; i < n; i++) { scanf("%d", &c[i]); for (j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } for (i = 1; i < (1 << n); i++) { e =...
#include <stdio.h> int main() { int n, i, j, k, m, a[12][12], c[12], x, mm = 10000000, d[12], e; scanf("%d", &n); scanf("%d", &m); scanf("%d", &x); for (i = 0; i < n; i++) { scanf("%d", &c[i]); for (j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } for (i = 1; i < (1 << n); i++) { e =...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13]]
0
309
import itertools N, M, X = [int(_) for _ in input().split()] B = [] for i in range(N): B.append([int(_) for _ in input().split()]) l = [i for i in range(N)] NUM = (10**5) * 12 + 1 ans = NUM for i in range(1, M+1): C = itertools.combinations(l, i) for c in C: amount = 0 U = [0 for i in range(...
import itertools N, M, X = [int(_) for _ in input().split()] B = [] for i in range(N): B.append([int(_) for _ in input().split()]) l = [i for i in range(N)] NUM = (10**5) * 12 + 1 ans = NUM for i in range(1, N+1): C = itertools.combinations(l, i) for c in C: amount = 0 U = [0 for i in range(...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
202
# -*- coding: utf-8 -*- N,M,X = list(map(int, input().rstrip().split())) C_list = [] A_list = [] for i in range(N): inp = list(map(int, input().rstrip().split())) C_list.append(inp[0]) A_list.append(inp[1:]) #----- bit = 1 << N max_price = sum(C_list) min_price = max_price for b in range(bit): pric...
# -*- coding: utf-8 -*- N,M,X = list(map(int, input().rstrip().split())) C_list = [] A_list = [] for i in range(N): inp = list(map(int, input().rstrip().split())) C_list.append(inp[0]) A_list.append(inp[1:]) #----- bit = 1 << N max_price = sum(C_list)*2 min_price = max_price for b in range(bit): pr...
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
193
def process(tab, tour, current, result,skill, N, M, X): finish = True for i in skill: if (i < X): finish = False break if (finish): if (result == -1): return current else: return min(result, current) if (tour == N or (curr...
def process(tab, tour, current, result,skill, N, M, X): finish = True for i in skill: if (i < X): finish = False break if (finish): if (result == -1): return current else: return min(result, current) if (tour == N or (curr...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
364
import itertools N, M, X = map(int, input().split()) a = [list(map(int, input().split())) for i in range(N)] li = [] for i in range(N): for j in itertools.combinations(range(N), i): sm = [0] * (M+1) for k in j: for l in range(M+1): sm[l] += a[k][l] if all(y >= X f...
import itertools N, M, X = map(int, input().split()) a = [list(map(int, input().split())) for i in range(N)] li = [] for i in range(N+1): for j in itertools.combinations(range(N), i): sm = [0] * (M+1) for k in j: for l in range(M+1): sm[l] += a[k][l] if all(y >= X...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
159
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) bool check_level(vector<int> level, int x) { int l = level.size(); for (int i = 0; i < l; i++) { if (level.at(i) < x) { return false; } } return true; } int main(void) { int n, m, x; cin >> n...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) bool check_level(vector<int> level, int x) { int l = level.size(); for (int i = 0; i < l; i++) { if (level.at(i) < x) { return false; } } return true; } int main(void) { int n, m, x; cin >> n...
[["+", 12, 16, 12, 2, 3, 4, 0, 16, 17, 72], ["+", 12, 16, 12, 2, 3, 4, 0, 16, 12, 13]]
1
356
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; int gcd(int x, int y) { if (x < y) swap(x, y); int r = x % y; if (r == 0) { return y; } return gcd(y, r); } int main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N, vect...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; typedef long long ll; int gcd(int x, int y) { if (x < y) swap(x, y); int r = x % y; if (r == 0) { return y; } return gcd(y, r); } int main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N, vect...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
356
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; const int INF = 1 << 30; void DFS(vector<vector<bool>> &bit, vector<bool> vec, int N) { if (vec.size() == N) bit.push_back(vec); else { vector<bool...
#include "bits/stdc++.h" #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) using namespace std; const int INF = 1 << 30; void DFS(vector<vector<bool>> &bit, vector<bool> vec, int N) { if (vec.size() == N) bit.push_back(vec); else { vector<bool...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
444
import itertools N,M,X = map(int,input().split()) book =[] for x in range(N): A_list = list(map(int, input().split())) book.append(A_list) conbination =[] for i, _ in enumerate(book, 1): for j in itertools.conbination(book, r=i): # rには1、2、3と渡される conbination.append(j) minn =100000000 for x in ...
import itertools N,M,X = map(int,input().split()) book =[] for x in range(N): A_list = list(map(int, input().split())) book.append(A_list) conbination =[] for i, _ in enumerate(book, 1): for j in itertools.combinations(book, r=i): # rには1、2、3と渡される conbination.append(j) minn =100000000 for x in...
[["-", 8, 196, 0, 7, 12, 652, 63, 319, 319, 22], ["+", 8, 196, 0, 7, 12, 652, 63, 319, 319, 22]]
5
181
import itertools as it n,m,x=map(int, input().split()) l=[] check=[0]*(m) ans=0 for i in range(n): a=list(map(int, input().split())) ans+=a[0] for j in range(m): check[j]+=a[j+1] l.append(a) if min(check)<x: print('-1') exit() for i in range(1,m+1): for p in it.combinations(range...
import itertools as it n,m,x=map(int, input().split()) l=[] check=[0]*(m) ans=0 for i in range(n): a=list(map(int, input().split())) ans+=a[0] for j in range(m): check[j]+=a[j+1] l.append(a) if min(check)<x: print('-1') exit() for i in range(1,n+1): for p in it.combinations(range...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
218
import itertools p = list(map(int,input().split())) N = p[0] M = p[1] X = p[2] l = [[int(i) for i in input().split()] for j in range(N)] hoge = [] kouho = list(range(1,N+1)) for i in itertools.combinations_with_replacement(kouho, N): hoge.append(list(set(i))) hoge = list(map(list, set(map(tuple, hoge)))) last_v...
import itertools p = list(map(int,input().split())) N = p[0] M = p[1] X = p[2] l = [[int(i) for i in input().split()] for j in range(N)] hoge = [] kouho = list(range(1,N+1)) for i in itertools.combinations_with_replacement(kouho, N): hoge.append(list(set(i))) hoge = list(map(list, set(map(tuple, hoge)))) last_v...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25]]
5
245
n, m, x = list(map(int, input().split())) a = [] c = [] for _ in range(n): list_ = list(map(int, input().split())) c.append(list_[0]) list_.pop(0) a.append(list_) res = -1 bit = [] for i in range(2 ** n): tmp = [False] * n for j in range(n): if i >> j & 1: tmp[j] = True b...
n, m, x = list(map(int, input().split())) a = [] c = [] for _ in range(n): list_ = list(map(int, input().split())) c.append(list_[0]) list_.pop(0) a.append(list_) res = -1 bit = [] for i in range(2 ** n): tmp = [False] * n for j in range(n): if i >> j & 1: tmp[j] = True b...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
256
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int M = scanner.nextInt(); int X = scanner.nextInt(); int[] C = new int[N]; int[][] A = new int[N][M]; for (int i = 0; i < N; i++) { ...
import java.util.*; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int M = scanner.nextInt(); int X = scanner.nextInt(); int[] C = new int[N]; int[][] A = new int[N][M]; for (int i = 0; i < N; i++) { ...
[["-", 0, 492, 3, 4, 0, 227, 497, 505, 0, 22], ["+", 0, 492, 3, 4, 0, 227, 497, 505, 0, 22]]
3
451
#include <iostream> #include <vector> using namespace std; int main(void) { int N, M, X; cin >> N >> M >> X; vector<int> C(N, 0); vector<vector<int>> A(N, vector<int>(M, 0)); for (int i = 0; i < N; i++) { cin >> C.at(i); for (int j = 0; j < M; j++) { cin >> A.at(i).at(j); } } int max...
#include <iostream> #include <vector> using namespace std; int main(void) { int N, M, X; cin >> N >> M >> X; vector<int> C(N, 0); vector<vector<int>> A(N, vector<int>(M, 0)); for (int i = 0; i < N; i++) { cin >> C.at(i); for (int j = 0; j < M; j++) { cin >> A.at(i).at(j); } } int max...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13]]
1
377
import numpy as np n, m, x = list(map(lambda x: int(x), input().split(' '))) sets = [] for i in range(n): sets.append(list(map(lambda x: int(x), input().split(' ')))) sets = np.array(sets) mincost = 10000000 maxnum = int(''.join(["1" for i in range(n)]), 2) if not np.all((np.sum(sets[:, 1:], axis=0) > x)): ...
import numpy as np n, m, x = list(map(lambda x: int(x), input().split(' '))) sets = [] for i in range(n): sets.append(list(map(lambda x: int(x), input().split(' ')))) sets = np.array(sets) mincost = 10000000 maxnum = int(''.join(["1" for i in range(n)]), 2) if not np.all((np.sum(sets[:, 1:], axis=0) >= x)): ...
[["-", 28, 652, 3, 4, 0, 23, 0, 666, 667, 47], ["+", 28, 652, 3, 4, 0, 23, 0, 666, 667, 20]]
5
250
import itertools N, M, X = list(map(int, input().split())) s = [list(map(int, input().split())) for i in range(N)] list_N = [i for i in range(N)] ans = [] for num_book in range(1, N + 1): for i in itertools.combinations(list_N, num_book): #print(i) temp = 0 for j in range(1, M + 1): ...
import itertools N, M, X = list(map(int, input().split())) s = [list(map(int, input().split())) for i in range(N)] list_N = [i for i in range(N)] ans = [] for num_book in range(1, N + 1): for i in itertools.combinations(list_N, num_book): #print(i) temp = 0 for j in range(1, M + 1): ...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 75, 76, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24]]
5
202
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) template <class T> bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; } template <class T> bool chmin(T &a, const T &b)...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <iostream> #include <map> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) template <class T> bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; } template <class T> bool chmin(T &a, const T &b)...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
357
N, M, X = list(map(int, input().split(" "))) import numpy as np vals = [] for i in range(N): v = list(map(int, input().split(" "))) vals.append(v) vals = np.array(vals) import itertools prod = [] for i in range(1, N+1): v = list(itertools.combinations(range(N), i)) prod.extend(v) money = 1e8 ...
N, M, X = list(map(int, input().split(" "))) import numpy as np vals = [] for i in range(N): v = list(map(int, input().split(" "))) vals.append(v) vals = np.array(vals) import itertools prod = [] for i in range(1, N+1): v = list(itertools.combinations(range(N), i)) prod.extend(v) money = 1e10 ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 531], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 531], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 31, 612], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 17, 72], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 531], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 531]]
5
201
#include <stdio.h> int main() { int n, m, x, i, j, c[12], a[12][12], u[13], min, s[12], cs, mino; scanf("%d %d %d", &n, &m, &x); min = 1; for (i = 0; i < n; i++) { scanf("%d", &c[i]); min += c[i]; u[i] = 0; for (j = 0; j < m; j++) scanf("%d", &a[i][j]); } mino = min; u[n] = 0; fo...
#include <stdio.h> int main() { int n, m, x, i, j, c[12], a[12][12], u[13], min, s[12], cs, mino; scanf("%d %d %d", &n, &m, &x); min = 1; for (i = 0; i < n; i++) { scanf("%d", &c[i]); min += c[i]; u[i] = 0; for (j = 0; j < m; j++) scanf("%d", &a[i][j]); } mino = min; u[n] = 0; fo...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 57, 15, 23, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 12, 22]]
0
350
N, M, X = gets.chomp.split(" ").map(&:to_i) B = Array.new(N).map{ gets.chomp.split(" ").map(&:to_i) } ans = [] (1...(1<<N)).each{|n| wk = Array.new(M+1, 0) (0..N).each{|k| if n[k] == 1 then (0...M).each{|m| wk[m] += B[k][m]} end } ans << wk[0] if wk[1..M].all?{|w| w >= X} } puts ans.empty? ? -...
N, M, X = gets.chomp.split(" ").map(&:to_i) B = Array.new(N).map{ gets.chomp.split(" ").map(&:to_i) } ans = [] (1...(1<<N)).each{|n| wk = Array.new(M+1, 0) (0..N).each{|k| if n[k] == 1 then (0..M).each{|m| wk[m] += B[k][m]} end } ans << wk[0] if wk[1..M].all?{|w| w >= X} } puts ans.empty? ? -1...
[["-", 64, 749, 0, 652, 486, 739, 0, 475, 17, 389], ["+", 64, 749, 0, 652, 486, 739, 0, 475, 17, 757]]
4
161
n,m,x = list(map(int,input().split())); price = [0]*n; rikai = [[0]*m for i in range(n)]; for i in range(n) : ca = list(map(int,input().split())); price[i] = ca[0]; for j in range(m) : rikai[i][j] = ca[j+1]; ans = sum(price); able = 0; for i in range(2**n) : allrikai = [0]*m; nowprice = 0;...
n,m,x = list(map(int,input().split())); price = [0]*n; rikai = [[0]*m for i in range(n)]; for i in range(n) : ca = list(map(int,input().split())); price[i] = ca[0]; for j in range(m) : rikai[i][j] = ca[j+1]; ans = sum(price); able = 0; for i in range(2**n) : allrikai = [0]*m; nowprice = 0;...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 19]]
5
241
from itertools import combinations def main(): N, M, X = list(map(int, input().split())) row = [] ans = 10 ** 10 for i in range(N): row.append(list(map(int, input().split()))) for k in range(1, N+1): co = list(combinations(row, k)) for t in co: cost = 0 ...
from itertools import combinations def main(): N, M, X = list(map(int, input().split())) row = [] ans = 10 ** 10 for i in range(N): row.append(list(map(int, input().split()))) for k in range(1, N+1): co = list(combinations(row, k)) for t in co: cost = 0 ...
[["-", 0, 57, 15, 23, 0, 666, 0, 657, 12, 612], ["+", 0, 57, 15, 23, 0, 666, 0, 657, 12, 612]]
5
180
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int n, m, x; vector<int> c; vector<vector<int>> a; int dfs() { int mn = pow(10, 6); rep(i, (1 << n)) { bitset<12> bt(i); int tp = 0; vector<int> ud(n, 0); bool fct = true; rep(j, n) { if (b...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int n, m, x; vector<int> c; vector<vector<int>> a; int dfs() { int mn = pow(10, 8); // cout << mn << endl; rep(i, (1 << n)) { bitset<12> bt(i); int tp = 0; vector<int> ud(m, 0); bool fct = true; ...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 0, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
332
#n=int(input()) n,m,x=map(int,input().split()) #a=list(map(int,input().split())) l=[list(map(int,input().split())) for i in range(n)] def tas(l1,l2): l3=[] for i in range(m+1): l3.append(l1[i]+l2[i]) return l3 ll=[[0 for i in range(m+1)]] for i in range(n): for j in range(len(ll)): ll...
#n=int(input()) n,m,x=map(int,input().split()) #a=list(map(int,input().split())) l=[list(map(int,input().split())) for i in range(n)] def tas(l1,l2): l3=[] for i in range(m+1): l3.append(l1[i]+l2[i]) return l3 ll=[[0 for i in range(m+1)]] for i in range(n): for j in range(len(ll)): ll...
[["+", 0, 7, 12, 652, 3, 4, 0, 652, 63, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
220
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n, m, x, ans = 2000000; cin >> n >> m >> x; vector<vector<int>> p(n); for (int i = 0; i < n; i++) { for (int j = 0; j < m ...
#include <algorithm> #include <cstdio> #include <iostream> #include <map> #include <queue> #include <string> #include <utility> #include <vector> using namespace std; int main() { int n, m, x, ans = 2000000; cin >> n >> m >> x; vector<vector<int>> p(n); for (int i = 0; i < n; i++) { for (int j = 0; j < m ...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
319
from itertools import combinations import numpy as np n,m,x = map(int, input().split()) q = [np.array(list(map(int, input().split()))) for _ in range(n)] L=[] for i in range(1,n): for j in list(combinations(q,i)): S = np.sum(j, axis=0) if all([k >= x for k in S[1:]]): L.append(S[0]) if...
from itertools import combinations import numpy as np n,m,x = map(int, input().split()) q = [np.array(list(map(int, input().split()))) for _ in range(n)] L=[] for i in range(1,n+1): for j in list(combinations(q,i)): S = np.sum(j, axis=0) if all([k >= x for k in S[1:]]): L.append(S[0]) ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
145
from itertools import combinations import numpy as np n,m,x=map(int, input().split()) S = [] for i in range(n): A=list(map(int, input().split())) S.append(A) ans = 10**9 for i in range(2,n+1): for comb in combinations(S,i): tmp = np.array([0]*m) cost = 0 for s in comb: ...
from itertools import combinations import numpy as np n,m,x=map(int, input().split()) S = [] for i in range(n): A=list(map(int, input().split())) S.append(A) ans = 10**9 for i in range(1,n+1): for comb in combinations(S,i): #print(comb) tmp = np.array([0]*m) cost = 0 ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612]]
5
176
#!/usr/bin/env python3 N, M, X = map(int, input().split()) li = [f'{i:012b}' for i in range(2**N)] C = [] A = [] for i in range(N): B = list(map(int, input().split())) C.append(B[0]) A.append(B[1:]) d = [] for l in li: b = l[::-1][:N] rikai = [0]*M pri = [0]*N for i in range(len(b)): ...
#!/usr/bin/env python3 N, M, X = map(int, input().split()) li = [f'{i:012b}' for i in range(2**N)] C = [] A = [] for i in range(N): B = list(map(int, input().split())) C.append(B[0]) A.append(B[1:]) d = [] for l in li: b = l[::-1][:N] rikai = [0]*M pri = [0]*N for i in range(len(b)): ...
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 57, 15, 666, 0, 657, 31, 657, 12, 612], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72], ["-", 0, 656, 0, 57, 15, 666, 0, 65...
5
259
#include "bits/stdc++.h" #include <string> using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; #define int ll const double PI = acos(-1.0); const int MOD = (int)pow(10, 9) + 7; #define YES(n) cout << ((n) ? "...
#include "bits/stdc++.h" #include <string> using namespace std; using ll = long long int; using ull = unsigned long long int; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; #define int ll const double PI = acos(-1.0); const int MOD = (int)pow(10, 9) + 7; #define YES(n) cout << ((n) ? "...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
2,037
import itertools as t n,m,z=map(int,input().split()) l=[] answer=set([]) for i in range(n): l.append(list(map(int, input().split()))) for k in range(n+1): a=list(t.combinations(range(n),k)) for x in a: w=0 A=[0 for _ in range(m)] s=0 for y in x: w+=l[y][0] ...
import itertools as t n,m,z=map(int,input().split()) l=[] answer=set([]) for i in range(n): l.append(list(map(int, input().split()))) for k in range(n+1): a=list(t.combinations(range(n),k)) for x in a: w=0 A=[0 for _ in range(m)] s=0 for y in x: w+=l[y][0] ...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
185
N,M,X = map(int,input().split()) books = [list(map(int,input().split())) for _ in range(N)] digit = "0"+str(N)+"b" ans = float("INF") for i in range(2**N): flags = list(format(i,digit)) rikaid = [0]*(M) cost = 0 for j in range(N): if flags[j] == "1": cost += books[j][0] f...
N,M,X = map(int,input().split()) books = [list(map(int,input().split())) for _ in range(N)] digit = "0"+str(N)+"b" ans = float("INF") for i in range(2**N): flags = list(format(i,digit)) rikaid = [0]*(M) cost = 0 for j in range(N): if flags[j] == "1": cost += books[j][0] f...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
188
#include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 1e5 + 10; struct node { int c; vector<int> v; }; node arr[maxn]; ll ans = 0x3f3f3f3f3f; vector<int> v; int n, m, x; int check() { int c[13]; for (int i = 0; i < v.size(); i++) { for (int j = 0; j < m; j++) { c[j] += ...
#include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 1e5 + 10; struct node { int c; vector<int> v; }; node arr[maxn]; ll ans = 0x3f3f3f3f3f; vector<int> v; int n, m, x; int check() { int c[13] = {0}; for (int i = 0; i < v.size(); i++) { for (int j = 0; j < m; j++) { c[...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
380
import itertools N,M,X=map(int, input().split()) data=[] ans=999999999 b=[] b_pairs=[] for i in range(N): b.append(i) for i in range(N): data.append(list(map(int, input().split()))) for i in range(2,N+1): b_pairs+=itertools.combinations(b,i) for i in range(N): flag=1 skill=[0]*M for j in rang...
import itertools N,M,X=map(int, input().split()) data=[] ans=999999999 b=[] b_pairs=[] for i in range(N): b.append(i) for i in range(N): data.append(list(map(int, input().split()))) for i in range(2,N+1): b_pairs+=itertools.combinations(b,i) for i in range(N): flag=1 skill=[0]*M for j in rang...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
311
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(12); vector<vector<int>> a(12, vector<int>(12)); for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; } int sum = 2000000; for (int tmp = 0; tmp < (1 ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(12); vector<vector<int>> a(12, vector<int>(12)); for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; } int sum = 2000000; for (int tmp = 0; tmp < (1 ...
[["-", 75, 76, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 60]]
1
255
import itertools n, m, x = map(int, input().split()) caaa = [list(map(int, input().split())) for _ in range(n)] ans = 10 ** 7 for i in range(1, n + 1): for caa in list(itertools.combinations(caaa, i)): c = 0 aa = [0] * m for j in range(0, i): c += caa[j][0] for k in r...
import itertools n, m, x = map(int, input().split()) caaa = [list(map(int, input().split())) for _ in range(n)] ans = 10 ** 7 for i in range(1, n + 1): for caa in list(itertools.combinations(caaa, i)): c = 0 aa = [0] * m for j in range(i): c += caa[j][0] for k in rang...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
168
#include <bits/stdc++.h> using namespace std; int N, M, X; int C[15], A[15][15]; int MAX = 200010; int skill[15]; int calc(int n, int val) { if (n == N) { bool flag = true; for (int i = 0; i < M; i++) { if (skill[i] < X) { flag = false; break; } } if (flag) { return...
#include <bits/stdc++.h> using namespace std; int N, M, X; int C[15], A[15][15]; int MAX = 2000100; int skill[15]; int calc(int n, int val) { if (n == N) { bool flag = true; for (int i = 0; i < M; i++) { if (skill[i] < X) { flag = false; break; } } if (flag) { retur...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
1
313
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define trace1(x...
#include <bits/stdc++.h> using namespace std; #define IOS \ ios::sync_with_stdio(0); \ cin.tie(0); \ cout.tie(0); #define trace1(x...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
354
n,m,x=map(int,input().split()) a=[] for i in range(0,n): aa=input().split() for j in range(0,m+1): aa[j]=int(aa[j]) a.append(aa) smin=1000000*n d=1000000*n for i in range(0,2**n): mo=0 x2=[1 for i2 in range(0,m)] for j in range(0,n): if ((i>>j)&1)==1: mo+=a[...
n,m,x=map(int,input().split()) a=[] for i in range(0,n): aa=input().split() for j in range(0,m+1): aa[j]=int(aa[j]) a.append(aa) smin=1000000*n d=1000000*n for i in range(0,2**n): mo=0 x2=[0 for i2 in range(0,m)] for j in range(0,n): if ((i>>j)&1)==1: mo+=a[...
[["-", 8, 196, 0, 1, 0, 662, 12, 658, 8, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 658, 8, 612]]
5
198
#include <bits/stdc++.h> using namespace std; #define ll long long #define PI 3.14159265359 int main() { int n, m, x, c[20], a[20][20], mm = 200000; bool flag = true; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (int ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define PI 3.14159265359 int main() { ll n, m, x, c[20], a[20][20], mm = 900000000; bool flag = true; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (in...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
273
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, c[12], a[12][12], b = 1, p = 10000000, p2, r[12], flag; cin >> n >> m >> x; for (int i = 0; i < n; i++) { b *= 2; cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (int i = 0; i < b; i++) { p2 = ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, c[12], a[12][12], b = 1, p = 10000000, p2, r[12], flag; cin >> n >> m >> x; for (int i = 0; i < n; i++) { b *= 2; cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (int i = 0; i < b; i++) { p2 = ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
292
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MOD 1000000007 #define MOD2 998244353 #define INF ((1 << 30) - 1) #define LINF (1LL << 60) #define EPS (1e-10) typedef long long Int; typedef pair<Int, Int> P; int a[15][15]; int price[15]; int main() { int n, m, x; ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MOD 1000000007 #define MOD2 998244353 #define INF ((1 << 30) - 1) #define LINF (1LL << 60) #define EPS (1e-10) typedef long long Int; typedef pair<Int, Int> P; int a[15][15]; int price[15]; int main() { int n, m, x; ...
[["-", 0, 7, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 7, 8, 9, 0, 43, 49, 80, 81, 22]]
1
283
#include <iostream> #include <sstream> #include <stdio.h> #define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cmath> #include <ctype.h> #include <limits> #include <list> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef ...
#include <iostream> #include <sstream> #include <stdio.h> #define _USE_MATH_DEFINES #include <algorithm> #include <bitset> #include <cmath> #include <ctype.h> #include <limits> #include <list> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <vector> typedef ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
396
// 失敗するからこそ // そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから #ifdef DAIJOBU #include "/home/v-o_o-v/deb.h" #define deb(x...) \ cerr << "[" << #x << "] = ["; \ _print(x) #else #include <bits/stdc++.h> #define deb(x......
// 失敗するからこそ // そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから #ifdef DAIJOBU #include "/home/v-o_o-v/deb.h" #define deb(x...) \ cerr << "[" << #x << "] = ["; \ _print(x) #else #include <bits/stdc++.h> #define deb(x......
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
595
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define PI 3.14159265359 #define INF 1000100100 #define all(x) (x).begin(), (x).end() typedef long long ll; #define P pair<ll, ll> #define PP pair<P, P> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; int san[n][m + 1]; r...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define PI 3.14159265359 #define INF 1000100100 #define all(x) (x).begin(), (x).end() typedef long long ll; #define P pair<ll, ll> #define PP pair<P, P> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; int san[n][m + 1]; r...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]]
1
291
def main(): import numpy as np from itertools import combinations n, m, x = map(int, input().split()) l = [list(map(int, input().split())) for _ in range(n)] ans = 10 ** 15 for i in range(1, m + 1): for comb in combinations(l, i): y = np.array([x for _ in range(m)]) ...
def main(): import numpy as np from itertools import combinations n, m, x = map(int, input().split()) l = [list(map(int, input().split())) for _ in range(n)] ans = 10 ** 15 for i in range(1, n + 1): for comb in combinations(l, i): y = np.array([x for _ in range(m)]) ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
182
#include <bits/stdc++.h> #define two(a) (1 << (a)) #define LINF (1ll << 61) #define EPS (1e-14) #define Lshift(a, b) ((a) << (b)) #define Rshift(a, b) ((a) >> (b)) #define rep(a, b) for (a = 0; a < b; a++) #define xrep(a, b, c) for (a = b; a < c; a++) #define INF (1 << 29) #define sz(a) int(a.size()) #define mset(x) me...
#include <bits/stdc++.h> #define two(a) (1 << (a)) #define LINF (1ll << 61) #define EPS (1e-14) #define Lshift(a, b) ((a) << (b)) #define Rshift(a, b) ((a) >> (b)) #define rep(a, b) for (a = 0; a < b; a++) #define xrep(a, b, c) for (a = b; a < c; a++) #define INF (1 << 29) #define sz(a) int(a.size()) #define mset(x) me...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22]]
1
346
from sys import stdin from itertools import combinations N,M,X = [int(x) for x in stdin.readline().rstrip().split()] data = [] for i in range(N): tmp = [int(x) for x in stdin.readline().rstrip().split()] data.append(tmp) ans = 10**18 for i in range(1,N): for j in combinations(data,i): C = 0 ...
from sys import stdin from itertools import combinations N, M, X = [int(x) for x in stdin.readline().rstrip().split()] data = [] for i in range(N): tmp = [int(x) for x in stdin.readline().rstrip().split()] data.append(tmp) ans = 10**18 for i in range(1, N+1): for j in combinations(data, i): C = 0 ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
188
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define en '\n' #define fs first #define sd second int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n, m; cin >> n >> m; ll x; cin >> x; vector<vector<ll>> b(n, ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; #define en '\n' #define fs first #define sd second int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll n, m; cin >> n >> m; ll x; cin >> x; vector<vector<ll>> b(n, ...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
313
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int m = Integer.parseInt(sc.next()); int x = Integer.parseInt(sc.next()); int[] c = new int[n]; int[][] a = new int[n][m]; for...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.next()); int m = Integer.parseInt(sc.next()); int x = Integer.parseInt(sc.next()); int[] c = new int[n]; int[][] a = new int[n][m]; for...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22]]
3
342
n,m,x = map(int,input().split()) A = [[] for _ in range(n)] for i in range(n): A[i] = list( map(int,input().split()) ) flag = 0 min_charge = 10**7 for i in range(2**n): which = format(i, '#010b')[-n:] #print(which,end = ':') charge = 0 skill = [0 for _ in range(m)] for j in range...
n,m,x = map(int,input().split()) A = [[] for _ in range(n)] for i in range(n): A[i] = list( map(int,input().split()) ) flag = 0 min_charge = 10**7 for i in range(2**n): which = format(i, '#020b')[-n:] #print(which,end = ':') charge = 0 skill = [0 for _ in range(m)] for j in range...
[["-", 12, 206, 51, 652, 3, 4, 0, 557, 0, 6], ["+", 12, 206, 51, 652, 3, 4, 0, 557, 0, 6]]
5
213
def resolve(): N, M, X = map(int, input().split()) L = []*M ans = 10000000000 for i in range(N): L.append(tuple(map(int, input().split()))) for i in range(2 ** N): s = 0 C = [0]*M for j in range(N): if (i >> j) & 1: C = [a+b for (a, b) in ...
def resolve(): N, M, X = map(int, input().split()) L = []*M ans = 10000000000 for i in range(N): L.append(tuple(map(int, input().split()))) for i in range(2 ** N): s = 0 C = [0]*M for j in range(N): if (i >> j) & 1: C = [a+b for (a, b) in ...
[["+", 0, 659, 12, 652, 3, 4, 0, 206, 0, 70], ["+", 12, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["+", 12, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["+", 0, 659, 12, 652, 3, 4, 0, 206, 0, 73]]
5
179
import copy N, M, X = map(int, input().split()) C =[] A = {} for i in range(N): ipt = list(map(int, input().split())) C.append(ipt[0]) A[i] = ipt[1:] bestscore = 99999999999 def rec(n, score, money): global bestscore if n==N: return s = copy.deepcopy(score) rec(n+1, s, money) money ...
import copy N, M, X = map(int, input().split()) C =[] A = {} for i in range(N): ipt = list(map(int, input().split())) C.append(ipt[0]) A[i] = ipt[1:] bestscore = 99999999999 def rec(n, score, money): global bestscore if n==N: return s = copy.deepcopy(score) rec(n+1, s, money) money ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
216
n,m,x=list(map(int, input().split())) ca=[] for i in range (n): ca.append(list(map(int, input().split()))) u=[0]*m for j in range (m): for i in range (n): u[j]+=ca[i][j+1] det=1 for y in range (m): if u[y]<x: det=0 if det==0: print(-1) else: cost=1300000 for z in range(2**n-1): ...
n,m,x=list(map(int, input().split())) ca=[] for i in range (n): ca.append(list(map(int, input().split()))) u=[0]*m for j in range (m): for i in range (n): u[j]+=ca[i][j+1] det=1 for y in range (m): if u[y]<x: det=0 if det==0: print(-1) else: cost=1300000 for z in range(2**n): ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
295
/** * author: rishabh_sethi **/ #include <bits/stdc++.h> #define pb push_back #define ll long long #define mem(x, val) memset(x, val, sizeof(x)) #define mk make_pair #define f(i, n) for (i = 0; i < n; i++) #define f1(i, n) for (i = 1; i <= n; i++) #define all(a) a.begin(), a.end() #define upp(v, val) upper_bound(...
/** * author: rishabh_sethi **/ #include <bits/stdc++.h> #define pb push_back #define ll long long #define mem(x, val) memset(x, val, sizeof(x)) #define mk make_pair #define f(i, n) for (i = 0; i < n; i++) #define f1(i, n) for (i = 1; i <= n; i++) #define all(a) a.begin(), a.end() #define upp(v, val) upper_bound(...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
1,544
// Template // #include <bits/stdc++.h> using namespace std; // マクロ // #define rep(i, N) for (int i = 0; i < (int)(N); i++) #define req(i, f, N) for (int i = f; i < (int)(N); i++) #define all(x) x.begin(), x.end() #define sort(x) sort(all(x)) #define uniq(x) x.erase(unique(all(x)), x.end()) #define vsum(x) accumulate(...
// Template // #include <bits/stdc++.h> using namespace std; // マクロ // #define rep(i, N) for (int i = 0; i < (int)(N); i++) #define req(i, f, N) for (int i = f; i < (int)(N); i++) #define all(x) x.begin(), x.end() #define sort(x) sort(all(x)) #define uniq(x) x.erase(unique(all(x)), x.end()) #define vsum(x) accumulate(...
[["-", 0, 7, 15, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 7, 15, 16, 12, 23, 0, 16, 12, 13], ["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13]]
1
910
import java.util.*; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt(); int rikai[] = new int[m]; int money[] = new int[n]; int book[][] = new int[n][m]; long min = -1; for (int i = 0; i < n; i...
import java.util.*; class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), m = sc.nextInt(), x = sc.nextInt(); int rikai[] = new int[m]; int money[] = new int[n]; int book[][] = new int[n][m]; long min = -1; for (int i = 0; i < n; i...
[["+", 0, 195, 8, 196, 0, 57, 75, 196, 0, 46], ["-", 0, 57, 75, 196, 0, 7, 8, 196, 0, 46]]
3
469
n , m , x = map(int,input().split()) c = [] a = [] for i in range(n): l = list(map(int,input().split())) c. append(l[0]) a.append(l[1:m+1]) S = sum(c) ans = S +1 for i in range(2**n): cost = 0 sum = [0,0,0] for j in range(n): if ((i>>j)&1): cost += c[j] sum = [x +...
n , m , x = map(int,input().split()) c = [] a = [] for i in range(n): l = list(map(int,input().split())) c. append(l[0]) a.append(l[1:m+1]) S = sum(c) ans = S +1 for i in range(2**n): cost = 0 sum = [0]*m for j in range(n): if ((i>>j)&1): cost += c[j] sum = [x + y...
[["-", 8, 196, 0, 1, 0, 662, 12, 634, 0, 21], ["-", 8, 196, 0, 1, 0, 662, 12, 634, 0, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
195
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, x; cin >> n >> m >> x; long long int ans = 1e9 + 7; long long int ca[n][m + 1]; for (int i = 0; i < n; i++) { for (int j = 0; j < m + 1; j++) { cin >> ca[i][j]; } } int step = 1; step <<= n; for (int i = 1; i...
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, x; cin >> n >> m >> x; long long int ans = 1e9 + 7; long long int ca[n][m + 1]; for (int i = 0; i < n; i++) { for (int j = 0; j < m + 1; j++) { cin >> ca[i][j]; } } int step = 1; step <<= n; for (int i = 1; i...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19]]
1
265
n, m, x = [int(i) for i in input().split()] arr = [] for _ in range(n): arr.append([int(i) for i in input().split()]) min_amount = float('+inf') has_sol = False def dfs(idx, amt, skills): global arr global min_amount global x global has_sol if idx == len(arr): ok = all(j >= x for j i...
n, m, x = [int(i) for i in input().split()] arr = [] for _ in range(n): arr.append([int(i) for i in input().split()]) min_amount = float('+inf') has_sol = False def dfs(idx, amt, skills): global arr global min_amount global x global has_sol if idx == len(arr): ok = all(j >= x for j i...
[["+", 0, 658, 8, 657, 12, 206, 206, 657, 17, 72], ["+", 0, 658, 8, 657, 12, 206, 206, 657, 12, 612]]
5
194
n, m, x = map(int, input().split()) sL = [0]*m bL = [] for i in range(n): book = list(map(int, input().split())) bL.append(book) def fullS(currentL, index, allP): if index > len(currentL): if min(currentL) >= x: return allP else: return -1 else: if min(c...
n, m, x = map(int, input().split()) sL = [0]*m bL = [] for i in range(n): book = list(map(int, input().split())) bL.append(book) def fullS(currentL, index, allP): if index >= len(bL): if min(currentL) >= x: return allP else: return -1 else: if min(curren...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 667, 20], ["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 22]]
5
239
import itertools N, M, X = map(int, input().split()) C = [] A = [] for i in range(N): tmp = list(map(int, input().split())) C.append(tmp[0]) A.append(tmp[1:]) C_total_min = -1 for ci in range(N): # 組み合わせの数 for seq in itertools.combinations(range(N), ci): # 組み合わせのリスト C_total = 0 A_tot...
import itertools N, M, X = map(int, input().split()) C = [] A = [] for i in range(N): tmp = list(map(int, input().split())) C.append(tmp[0]) A.append(tmp[1:]) C_total_min = -1 for ci in range(1, N+1): # 組み合わせの数 for seq in itertools.combinations(range(N), ci): # 組み合わせのリスト C_total = 0 ...
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
196
#include <bits/stdc++.h> using namespace std; int main() { long n, t, a, b, c, m, x, mi, aux; cin >> n >> m >> x; deque<long> A[n]; long R[n]; long au[n]; for (int i = 0; i < n; i++) { cin >> R[i]; for (int l = 0; l < m; l++) { cin >> a; A[i].push_back(a); } } mi = 10000000; f...
#include <bits/stdc++.h> using namespace std; int main() { long n, t, a, b, c, m, x, mi, aux; cin >> n >> m >> x; deque<long> A[n]; long R[n]; long au[m]; for (int i = 0; i < n; i++) { cin >> R[i]; for (int l = 0; l < m; l++) { cin >> a; A[i].push_back(a); } } mi = 10000000; f...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22]]
1
297
#include <bits/stdc++.h> using namespace std; long long cr[50], p, n, m, a[50], c[50][50], ans, k, F; void go(int cur, int r, long long x) { for (k = 1; k <= m; k++) { cr[k] += r * c[cur][r]; } int f = 0; for (k = 1; k <= m; k++) { if (cr[k] < p) f = 1; } // cout<<cur<<" "<<r<<" "<<x<<endl; ...
#include <bits/stdc++.h> using namespace std; long long cr[50], p, n, m, a[50], c[50][50], ans, k, F; void go(int cur, int r, long long x) { for (k = 1; k <= m; k++) { cr[k] += r * c[cur][k]; } int f = 0; for (k = 1; k <= m; k++) { if (cr[k] < p) f = 1; } // cout<<cur<<" "<<r<<" "<<x<<endl;...
[["-", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 16, 12, 69, 341, 342, 0, 22], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 8, 9, 0, 57, 64, 1, 0, 34, 0, 21], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
316
#include <bits/stdc++.h> using namespace std; const int N = 19; int n, m, x, res = 1e9; int c[N], a[N][N]; int sum[N]; bool _check() { for (int i = 1; i <= m; ++i) if (sum[i] < x) return false; return true; } void _try(int i, int cost) { if (i == n) { if (_check()) res = min(res, cost); ...
#include <bits/stdc++.h> using namespace std; const int N = 19; int n, m, x, res = 1e9; int c[N], a[N][N]; int sum[N]; bool _check() { for (int i = 1; i <= m; ++i) if (sum[i] < x) return false; return true; } void _try(int i, int cost) { if (i > n) { if (_check()) res = min(res, cost); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
408
N,M,X = map(int,input().split()) books = [] for _ in range(N): line = list(map(int,input().split())) books.append(line) values = [] for i in range(2**N): bags = [] for j in range(N): if ((i >> j) & 1): bags.append(j) value = 0 algs = [0] * M for k in bags: v...
N,M,X = map(int,input().split()) books = [] for _ in range(N): line = list(map(int,input().split())) books.append(line) values = [] for i in range(2**N): bags = [] for j in range(N): if ((i >> j) & 1): bags.append(j) value = 0 algs = [0] * M for k in bags: v...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
181
from itertools import combinations N,M,X = map(int,input().split()) C = [] for _ in range(N): C.append([int(v) for v in input().split()]) Ca,Aa = [],[] for k in range(1,N): for v in combinations(C,k): tmp = [0]*(M+1) for v2 in v: for i,v3 in enumerate(v2): tmp[i]+=v3 isOK = True for v2...
from itertools import combinations N,M,X = map(int,input().split()) C = [] for _ in range(N): C.append([int(v) for v in input().split()]) Ca,Aa = [],[] for k in range(1,N+1): for v in combinations(C,k): tmp = [0]*(M+1) for v2 in v: for i,v3 in enumerate(v2): tmp[i]+=v3 isOK = True for ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
172
#include <bits/stdc++.h> using namespace std; long long int N, M, X; long long int C[17]; long long int A[17][17]; long long int knowledge[17]; long long tryPoss(int toRead) { long long cost = 0; for (int i = 0; i < N; i++) { if ((toRead & (1 << i)) > 0) { // printf("toRead = %d, %d, %d\n", toRead, (1...
#include <bits/stdc++.h> using namespace std; long long int N, M, X; long long int C[17]; long long int A[17][17]; long long int knowledge[17]; long long tryPoss(int toRead) { long long cost = 0; for (int i = 0; i < N; i++) { if ((toRead & (1 << i)) > 0) { // printf("toRead = %d, %d, %d\n", toRead, (1...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13]]
1
352
#include <bits/stdc++.h> using namespace std; void solve() {} int main() { long long n, m, x; cin >> n >> m >> x; vector<long long> c(n); vector<vector<long long>> a(n, vector<long long>(m)); for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; } long long M...
#include <bits/stdc++.h> using namespace std; void solve() {} int main() { long long n, m, x; cin >> n >> m >> x; vector<long long> c(n); vector<vector<long long>> a(n, vector<long long>(m)); for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; } long long M...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
276
N,M,X=gets.split.map(&:to_i) b=[[0]*(M+1)] N.times{ a=gets.split.map(&:to_i) d=[] b.each{|c| d<<(M+1).times.map{|i|c[i]+a[i]} } b+=d } b.sort{|x,y|x[0]<=>y[0]}.each{|c| if (1...M).all?{|i|c[i]>=X} p c[0] exit end } p -1
N,M,X=gets.split.map(&:to_i) b=[[0]*(M+1)] N.times{ a=gets.split.map(&:to_i) d=[] b.each{|c| d<<(M+1).times.map{|i|c[i]+a[i]} } b+=d } b.sort{|x,y|x[0]<=>y[0]}.each{|c| if (1..M).all?{|i|c[i]>=X} p c[0] exit end } p -1
[["-", 0, 121, 15, 652, 486, 739, 0, 475, 17, 389], ["+", 0, 121, 15, 652, 486, 739, 0, 475, 17, 757]]
4
139
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**9) # 1 ✕ N N, M, X = list(map(int, input().rstrip().split())) # # N ✕ M (2D array) A = list(input().rstrip().split() for _ in range(N)) ans = 1e9 for bit in range(2 ** N): total = 0 array = [0 for _ in range(0, M)] for i in range(N): if...
#!/usr/bin/env python3 import sys sys.setrecursionlimit(10**9) # 1 ✕ N N, M, X = list(map(int, input().rstrip().split())) # N ✕ M (2D array) A = list(input().rstrip().split() for _ in range(N)) ans = 1e9 for bit in range(2 ** N): total = 0 array = [0 for _ in range(M)] for i in range(N): if bit ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 21], ["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 12, 652, 3, 4, 0, 206, 206, 657, 17, 72], ["+", 12, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
187
#include <bits/stdc++.h> using namespace std; #define fio ios_base::sync_with_stdio(false), cin.tie(NULL) #define ll long long #define int long long #define ull unsigned long long #define ld long double #define sb __builtin_popcount #define vi vector<int> #define vc vector<char> #define ii pair<int, int> #define pq pri...
#include <bits/stdc++.h> using namespace std; #define fio ios_base::sync_with_stdio(false), cin.tie(NULL) #define ll long long #define int long long #define ull unsigned long long #define ld long double #define sb __builtin_popcount #define vi vector<int> #define vc vector<char> #define ii pair<int, int> #define pq pri...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 7, 15, 16, 31, 16, 17, 18], ["+", 8, 9, 0, 7, 15, 16, 31, 16, 17, 19]]
1
506
import itertools def main(): N,M,X = list(map(int, input().split(' '))) inputs = [] for _ in range(N): inputs.append(list(map(int, input().split(' ')))) Ci = [s[0] for s in inputs] Aij = [s[1:] for s in inputs] # print(Ci, Aij) indexs = [i for i in range(N)] ...
import itertools def main(): N,M,X = list(map(int, input().split(' '))) inputs = [] for _ in range(N): inputs.append(list(map(int, input().split(' ')))) Ci = [s[0] for s in inputs] Aij = [s[1:] for s in inputs] # print(Ci, Aij) indexs = [i for i in range(N)] ...
[["-", 8, 196, 0, 1, 0, 662, 12, 658, 8, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 658, 8, 612]]
5
250
import itertools N,M,X = map(int, input().split()) C = [] for c in range(N): C.append(list(map(int, input().split()))) ans = float('inf') L = list(range(N)) for i in range(1, N+1): for comb in itertools.combinations(L, i): kingaku = 0 TM = [0]*M for c in comb: kingaku += C...
import itertools N,M,X = map(int, input().split()) C = [] for c in range(N): C.append(list(map(int, input().split()))) ans = float('inf') L = list(range(N)) for i in range(1, N+1): for comb in itertools.combinations(L, i): kingaku = 0 TM = [0]*M for c in comb: kingaku += C...
[["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
187
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; int minM = 2e8; bool found = false; bool check_state(vector<int> state, int X) { for (int i = 0; i < state.size(); i++) { if (state[i] < X) { return false; } } return true; } void money(vector<vector<i...
#include <algorithm> #include <iostream> #include <map> #include <vector> using namespace std; int minM = 2e8; bool found = false; bool check_state(vector<int> state, int X) { for (int i = 0; i < state.size(); i++) { if (state[i] < X) { return false; } } return true; } void money(vector<vector<i...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13]]
1
395
import numpy as np from itertools import combinations n, m, x = map(int, input().split()) lis = [list(map(int, input().split())) for _ in range(n)] # print(n, m, x, lis) ans = 10 ** 9 for i in range(1, n+1): combination = combinations(range(n), i) for comb in combination: init = np.zeros(m+1) ...
import numpy as np from itertools import combinations n, m, x = map(int, input().split()) lis = [list(map(int, input().split())) for _ in range(n)] # print(n, m, x, lis) ans = 10 ** 9 for i in range(1, n+1): combination = combinations(range(n), i) for comb in combination: init = np.zeros(m+1) ...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 95], ["+", 36, 36, 0, 656, 0, 57, 75, 76, 0, 102]]
5
164
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 typedef long long ll; int main() { ll n, m, x; cin >> n >> m >> x; ll temp; ll book[n + 10][m + 10]; ll skill[n + 10]; ll ans = MOD; bool can = false; bool exist = false; bool allcan = false; for (ll i = 0; i < n; i++) { for (...
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 typedef long long ll; int main() { ll n, m, x; cin >> n >> m >> x; ll temp; ll book[n + 10][m + 10]; ll skill[m + 10]; ll ans = MOD; bool can = false; bool exist = false; bool allcan = false; for (ll i = 0; i < n; i++) { for (...
[["-", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
319
#include <bits/stdc++.h> #include <chrono> using namespace std::chrono; using namespace std; #define fr(x, i, n) for (int x = i; x < n; ++x) #define fb(x, i, n) for (int x = i; x >= n; --x) #define pr pair<int, int> #define ll long long int const int mod = 1e9 + 7; /* auto start = high_resolution_clock::now(); a...
#include <bits/stdc++.h> #include <chrono> using namespace std::chrono; using namespace std; #define fr(x, i, n) for (int x = i; x < n; ++x) #define fb(x, i, n) for (int x = i; x >= n; --x) #define pr pair<int, int> #define ll long long int const int mod = 1e9 + 7; /* auto start = high_resolution_clock::now(); a...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
343
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e9; const ll MOD = 1e9 + 7; #define all(v) v.begin(), v.end() #define repi(i, n, init) for (ll i = init; i < (n); i++) #define repd(i, n, init) for (ll i = (n); i >= init; i--) #define repm(i, m) for (auto i = m.begin(); i != m.end(); i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll INF = 1e9; const ll MOD = 1e9 + 7; #define all(v) v.begin(), v.end() #define repi(i, n, init) for (ll i = init; i < (n); i++) #define repd(i, n, init) for (ll i = (n); i >= init; i--) #define repm(i, m) for (auto i = m.begin(); i != m.end(); i...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
343
from itertools import combinations N, M, X = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(N)] res = float('inf') for r in range(N): for c in combinations(range(N), r): skills = [0] * M price = 0 for i in c: price += books[i][0] f...
from itertools import combinations N, M, X = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(N)] res = float('inf') for r in range(N + 1): for c in combinations(range(N), r): skills = [0] * M price = 0 for i in c: price += books[i][0] ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
165
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n, vector<int>(m + 1)); for (int i = 0; i < n; i++) for (int j = 0; j <= m; j++) cin >> a[i][j]; int ans = 0x3f3f3f3f; for (int i = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n, vector<int>(m + 1)); for (int i = 0; i < n; i++) for (int j = 0; j <= m; j++) cin >> a[i][j]; int ans = 0x3f3f3f3f; for (int i = 0; ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
276
import itertools n, m, x = map(int, input().split()) c = [None] * n a = [None] * n for i in range(n): aa = list(map(int, input().split())) c[i] = aa[0] a[i] = aa[1:] ans = 100000000000 for k in range(n): for cmb in itertools.combinations(range(n), k): d = [0] * m cost = 0 for c...
import itertools n, m, x = map(int, input().split()) c = [None] * n a = [None] * n for i in range(n): aa = list(map(int, input().split())) c[i] = aa[0] a[i] = aa[1:] ans = 100000000000 for k in range(1, n + 1): for cmb in itertools.combinations(range(n), k): d = [0] * m cost = 0 ...
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
192
import numpy as np n,m,x=map(int,input().split()) MAX=9999999999 c=[] a=[] for i in range(n): ca=list(map(int,input().split())) c.append(ca[0]) a.append(ca[1:]) c=np.array(c) a=np.array(a) pat=2**n ans=MAX for i in range(pat): pat_i=bin(i)[2:].zfill(3) ai=np.array([0 for _ in range(m)]) ansi=...
import numpy as np n,m,x=map(int,input().split()) MAX=9999999999 c=[] a=[] for i in range(n): ca=list(map(int,input().split())) c.append(ca[0]) a.append(ca[1:]) c=np.array(c) a=np.array(a) pat=2**n ans=MAX for i in range(pat): pat_i=bin(i)[2:].zfill(n) ai=np.array([0 for _ in range(m)]) ansi=...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
215
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define int long long //#define _GLIBCXX_DEBUG signed main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N, vector<int>(M)); rep(i, N) { cin ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define int long long //#define _GLIBCXX_DEBUG signed main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N, vector<int>(M)); rep(i, N) { cin ...
[["-", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22]]
1
261
#include <bits/stdc++.h> using namespace std; const int Nmax = 2e5 + 10; const int Mod = 1e9 + 7; const int oo = 2e9; int n, m, x, cmin; int st[20], vf[20], a[20][20]; void Back(int top) { if (top == n + 1) { int cost = 0; memset(vf, 0, 20); for (int i = 1; i <= n; i++) if (st[i]) { cost...
#include <bits/stdc++.h> using namespace std; const int Nmax = 2e5 + 10; const int Mod = 1e9 + 7; const int oo = 2e9; int n, m, x, cmin; int st[20], vf[20], a[20][20]; void Back(int top) { if (top == n + 1) { int cost = 0; memset(vf, 0, sizeof vf); for (int i = 1; i <= n; i++) if (st[i]) { ...
[["-", 64, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 105, 0, 150], ["+", 0, 1, 0, 2, 3, 4, 0, 105, 51, 22]]
1
316
n,m,co=map(int,input().split()) l=[] for i in range(n): l.append(list(map(int,input().split()))) c=2**n ans=10**10 for i in range(c): li=[] a=0 for j in range(n): if ((i >> j) & 1): li.append(l[j]) a+=l[j][0] z=[0]*m for k in range(len(li)): for kk in range(m): z[kk]+=li[...
n,m,co=map(int,input().split()) l=[] for i in range(n): l.append(list(map(int,input().split()))) c=2**n ans=10**10 for i in range(c): li=[] a=0 for j in range(n): if ((i >> j) & 1): li.append(l[j]) a+=l[j][0] z=[0]*m for k in range(len(li)): for kk in range(m): z[kk]+=li[...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
186
#include <algorithm> #include <climits> #include <functional> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; int main() { ll N, M, X; ll C[20];...
#include <algorithm> #include <climits> #include <functional> #include <iostream> #include <math.h> #include <queue> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <unordered_set> #include <vector> using namespace std; typedef long long ll; int main() { ll N, M, X; ll C[20];...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
320
n,m,x=map(int,input().split()) from itertools import product li=[] ans=10**9 for i in range(n): a=list(map(int,input().split())) li.append(a) for p in product([0, 1], repeat = n): cnt = [0 for _ in range(m)] price=0 for i in range(n): if p[i]==1: price+=li[i][0] for j...
n,m,x=map(int,input().split()) from itertools import product li=[] ans=10**9 for i in range(n): a=list(map(int,input().split())) li.append(a) for p in product([0, 1], repeat = n): cnt = [0 for _ in range(m)] price=0 for i in range(n): if p[i]==1: price+=li[i][0] for j...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
173
N, M, X = map(int, input().split()) C, A = [], [] ans = 100000 exist = False for n in range(N): li = list(map(int, input().split())) C.append(li[0]) A.append(li[1:]) for b in range(1 << N): amount = 0 understand = [0] * M for n in range(N): if (b >> n) & 1 == 1: amount += C[n...
N, M, X = map(int, input().split()) C, A = [], [] ans = 1200000 exist = False for n in range(N): li = list(map(int, input().split())) C.append(li[0]) A.append(li[1:]) for b in range(1 << N): amount = 0 understand = [0] * M for n in range(N): if (b >> n) & 1 == 1: amount += C[...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
192
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define FOR(i, l, r) for (i = l; i < r; i++) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define P pair<ll, ll> #define F first #define S second signed main() { ll N, M, X, i, j, k, ans = -1; cin >> N >> M >> X; ll C[N], ...
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define FOR(i, l, r) for (i = l; i < r; i++) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() #define P pair<ll, ll> #define F first #define S second signed main() { ll N, M, X, i, j, k, ans = -1; cin >> N >> M >> X; ll C[N], ...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 106], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["+", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25]]
1
251
#!/usr/bin/env python3 import sys def main(): N, M, X = map(int, input().split()) C = [None] * N A = [None for _ in range(N)] for i in range(N): C[i], *A[i] = map(int, input().split()) # print(C,A) ans = 10**12 for i in range(2**N): tmp = [0] * N tmpC = 0 ...
#!/usr/bin/env python3 import sys def main(): N, M, X = map(int, input().split()) C = [None] * N A = [None for _ in range(N)] for i in range(N): C[i], *A[i] = map(int, input().split()) # print(C,A) ans = 10**12 for i in range(2**N): tmp = [0] * M tmpC = 0 ...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
207
import sys from collections import defaultdict, Counter, deque from itertools import accumulate, permutations, combinations from operator import itemgetter from bisect import bisect_left, bisect_right, bisect from heapq import heappop, heappush from math import gcd from math import ceil, floor, sqrt, cos, sin, pi from ...
import sys from collections import defaultdict, Counter, deque from itertools import accumulate, permutations, combinations from operator import itemgetter from bisect import bisect_left, bisect_right, bisect from heapq import heappop, heappush from math import gcd from math import ceil, floor, sqrt, cos, sin, pi from ...
[["-", 0, 662, 12, 206, 206, 657, 31, 657, 31, 22], ["+", 0, 662, 12, 206, 206, 657, 31, 657, 31, 22]]
5
250
#include <bits/stdc++.h> #define pp push_back #define pf push_front #define mp make_pair #define fs first #define sc second #define sf scanf using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> ii; const int N = (int)17; const int INF = (ll)2e9 + 7; int n, m, x; int a[...
#include <bits/stdc++.h> #define pp push_back #define pf push_front #define mp make_pair #define fs first #define sc second #define sf scanf using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> ii; const int N = (int)17; const int INF = (ll)2e9 + 7; int n, m, x; int a[...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 17, 19]]
1
354
#include <bits/stdc++.h> using namespace std; #define x first #define y second #define forn(i, n) for (int i = 0; i < int(n); ++i) typedef pair<int, int> pii; int mat[20][20]; int cost[20]; int N, M, X; int mon = 1000000000; void solve() { int u = (1 << N) - 1; forn(j, u) { vector<int> bina(N, 0); int c = ...
#include <bits/stdc++.h> using namespace std; #define x first #define y second #define forn(i, n) for (int i = 0; i < int(n); ++i) typedef pair<int, int> pii; int mat[20][20]; int cost[20]; int N, M, X; int mon = 1000000000; void solve() { int u = (1 << N); forn(j, u) { vector<int> bina(N, 0); int c = j; ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
330
#include <bits/stdc++.h> using namespace std; long long arr[13][13], price[13], total = 0, smarts[13], N, M, X, minim = 1e7; bool cek() { for (long long i = 0; i < M; i++) { if (smarts[i] < X) return false; } return true; } void solve(long long x) { if (x == M) { if (cek()) { minim = min(min...
#include <bits/stdc++.h> using namespace std; long long arr[13][13], price[13], total = 0, smarts[13], N, M, X, minim = 1e7; bool cek() { for (long long i = 0; i < M; i++) { if (smarts[i] < X) return false; } return true; } void solve(long long x) { if (x == N) { if (cek()) { minim = min(min...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
300
import java.util.*; public class Main { private static int N; private static int M; public static void main(String args[]) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); M = sc.nextInt(); int X = sc.nextInt(); int[] C = new int[N]; int[][] A = new int[N][M]; for (int i = 0; i...
import java.util.*; public class Main { private static int N; private static int M; public static void main(String args[]) { Scanner sc = new Scanner(System.in); N = sc.nextInt(); M = sc.nextInt(); int X = sc.nextInt(); int[] C = new int[N]; int[][] A = new int[N][M]; for (int i = 0; i...
[["-", 8, 196, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
469
import sys from itertools import product sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, m, x = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(n)] res = f_inf for pattern in product([0, 1], repeat=n): A = [0 for _ in rang...
import sys from itertools import product sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n, m, x = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(n)] res = f_inf for pattern in product([0, 1], repeat=n): A = [0 for _ in rang...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
203