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
n,m,x = gets.split.map(&:to_i) list = [] n.times {list.push(gets.split.map(&:to_i))} ans = 10**9 [1,0].repeated_permutation(n) do |perm| sum = [0]*(m+1) list.zip(perm).each do |i| tmp = i[0]*i[1] sum = sum.zip(tmp).map{|f,s| f+s} unless tmp.empty? end flag = true 1.upto(m-1) do...
n,m,x = gets.split.map(&:to_i) list = [] n.times {list.push(gets.split.map(&:to_i))} ans = 10**9 [1,0].repeated_permutation(n) do |perm| sum = [0]*(m+1) list.zip(perm).each do |i| tmp = i[0]*i[1] sum = sum.zip(tmp).map{|f,s| f+s} unless tmp.empty? end flag = true 1.upto(m) do |...
[["-", 8, 736, 0, 652, 3, 4, 0, 738, 17, 33], ["-", 8, 736, 0, 652, 3, 4, 0, 738, 12, 612], ["+", 196, 737, 8, 736, 0, 751, 15, 739, 0, 24], ["+", 196, 737, 8, 736, 0, 751, 15, 739, 0, 25]]
4
169
N, M, X = map(int, input().split()) CAAA = [input().split() for i in range(N)] price=0 ans=100000 for i in range(1, 2**N): price=0 rikaido = [0]*M for j in range(N): if i>>j & 1: price += int(CAAA[j][0]) for k in range(M): rikaido[k] += int(CAAA[j][k+1]) for l in rikaido: if l < X:...
N, M, X = map(int, input().split()) CAAA = [input().split() for i in range(N)] ans=100000000000 for i in range(1, 2**N): price=0 rikaido = [0]*M for j in range(N): if i>>j & 1: price += int(CAAA[j][0]) for k in range(M): rikaido[k] += int(CAAA[j][k+1]) for l in rikaido: ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
153
N, M, X = map(int, input().split()) CAAA = [input().split() for i in range(N)] ans = 1000000000 for k in range(2**N): price = 0 rikaido=[0]*M for l in range(N): if k>>l & 1: #if CAAA[m][1] < price: price += int(CAAA[l][0]) for t in range(M): rikaido[t] += int(CAAA[l][t]) for...
N, M, X = map(int, input().split()) CAAA = [input().split() for i in range(N)] ans = 1000000000 for k in range(1, 2**N): price = 0 rikaido=[0]*M for l in range(N): if k>>l & 1: #if CAAA[m][1] < price: price += int(CAAA[l][0]) for t in range(M): rikaido[t] += int(CAAA[l][t+1]) ...
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 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
147
n, m, x = map(int, input().split()) prace = [] know = [] for i in range(n): acc = list(map(int, input().split())) prace.append(acc[0]) know.append(acc[1:]) ans = 10**10 for i in range(2**n): und = [0 for i in range(m)] f = "{:b}".format(i) s = f.zfill(m) mm = 0 for j in range(len(s)): ...
n, m, x = map(int, input().split()) prace = [] know = [] for i in range(n): acc = list(map(int, input().split())) prace.append(acc[0]) know.append(acc[1:]) ans = 10**10 for i in range(2**n): und = [0 for i in range(m)] f = "{:b}".format(i) s = f.zfill(n) mm = 0 for j in range(len(s)): ...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
210
import itertools def m(): N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] ans = float('inf') for i in itertools.product([True, False], repeat=N): tmp = [0] * (M + 1) for j, v in enumerate(i): if j: for k in range(...
import itertools def m(): N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] ans = float('inf') for i in itertools.product([True, False], repeat=N): tmp = [0] * (M + 1) for j, v in enumerate(i): if v: for k in range(...
[["-", 8, 196, 0, 7, 8, 196, 0, 57, 15, 22], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 15, 22]]
5
184
def m(): N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] ans = float('inf') for i in range(2 ** N): b = bin(i)[2:] b = b.zfill(N) tmp = [0] * (M + 1) for j, v in enumerate(b): if v == '0': continue ...
def m(): N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] ans = float('inf') for i in range(2 ** N): b = bin(i)[2:] b = b.zfill(N) tmp = [0] * (M + 1) for j, v in enumerate(b): if v == '0': continue ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
216
n, m, x = map(int,input().split(' ')) a = [[] for i in range(n)] p = 0 for i in range(n): a[i] = list(map(int, input().split(' '))) sc = 999999 for i in range(1, 2 ** n): bi = '0' * n + bin(i)[2:] bi = bi[len(bi) - n:] cc = 0 e = [0] * m for j in range(n): if bi[j] == '1': fo...
n, m, x = map(int,input().split(' ')) a = [[] for i in range(n)] p = 0 for i in range(n): a[i] = list(map(int, input().split(' '))) sc = 12 * 100001 for i in range(1, 2 ** n): bi = '0' * n + bin(i)[2:] bi = bi[len(bi) - n:] cc = 0 e = [0] * m for j in range(n): if bi[j] == '1': ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 662, 12, 41, 0, 666, 0, 657, 31, 612], ["+", 0, 662, 12, 41, 0, 666, 0, 657, 17, 48]]
5
214
n,m,x = map(int,input().split()) c_ = [list(map(int,input().split())) for i in range(n)] # print(c_) cc_ = [] for i in range(n): cc_.append(c_[i][0]) # print(cc_) import numpy as np import itertools l_ = np.arange(n).tolist() res_ = [] resList = [] flag = False flag3 = True if n == 1: for i in range(m): ...
n,m,x = map(int,input().split()) c_ = [list(map(int,input().split())) for i in range(n)] # print(c_) cc_ = [] for i in range(n): cc_.append(c_[i][0]) # print(cc_) import numpy as np import itertools l_ = np.arange(n).tolist() res_ = [] resList = [] flag = False flag3 = True if n == 1: for i in range(m): ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
268
#include <bits/stdc++.h> using namespace std; #define pb push_back #define pf push_front typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define mp make_pair #define fi first #define se second typedef pair<int, int> pint; #define All(s) s.begi...
#include <bits/stdc++.h> using namespace std; #define pb push_back #define pf push_front typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define mp make_pair #define fi first #define se second typedef pair<int, int> pint; #define All(s) s.begi...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
337
#include <bits/stdc++.h> using namespace std; static const int INF = 1000000000; int main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N); int A[N][M]; for (int i = 0; i < N; i++) { cin >> C.at(i); for (int j = 0; j < M; j++) cin >> A[i][j]; } int ans = INF; for (int bit = 0; bit < (...
#include <bits/stdc++.h> using namespace std; static const int INF = 1000000000; int main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N); int A[N][M]; for (int i = 0; i < N; i++) { cin >> C.at(i); for (int j = 0; j < M; j++) cin >> A[i][j]; } int ans = INF; for (int bit = 0; bit < (...
[["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 7, 8, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 57, 64, 1, 0, 11, 17, 32]]
1
272
import numpy as np #%% N, M, X = [int(i) for i in input().split()] CA = [[] for i in range(N)] for i in range(N): k = list(map(int, input().split())) CA[i] = k[:] CA = np.array(CA) #%% cnt = (10 ** 5) * N + 1 for i in range(2 ** N): score = np.zeros(N + 1) for j in range(N): if (i >> j) & 1: ...
import numpy as np #%% N, M, X = [int(i) for i in input().split()] CA = [[] for i in range(N)] for i in range(N): k = list(map(int, input().split())) CA[i] = k[:] CA = np.array(CA) #%% cnt = (10 ** 5) * N + 1 for i in range(2 ** N): score = np.zeros(M + 1) for j in range(N): if (i >> j) & 1: ...
[["-", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
201
n,m,x = map(int, input().split()) costs = [list(map(int, input().split())) for _ in range(n)] ''' n,m,x = [int(i) for i in input().split()] costs =[] for i in range(n): a = [int(i) for i in input().split()] costs.append(a) ''' INF = 1000000000000000000000000000 ans = INF for i in range(1<<n): #n bits all ...
n,m,x = map(int, input().split()) costs = [list(map(int, input().split())) for _ in range(n)] ''' n,m,x = [int(i) for i in input().split()] costs =[] for i in range(n): a = [int(i) for i in input().split()] costs.append(a) ''' INF = 1000000000000000000000000000 ans = INF for i in range(1<<n): #n bits all ...
[["-", 0, 57, 15, 652, 3, 668, 0, 659, 31, 22], ["+", 0, 57, 15, 652, 3, 668, 0, 659, 31, 22]]
5
166
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m)); ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<int, int>; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) int main() { ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m)); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
280
# ---------------------------- N,M,X = map(int, input().split()) A = [list(map(int, input().split(" "))) for i in range(N)] MOD = 10**9+7 a = [0]*M value = [0] ans = MOD for i in range(2**N): for j in range(M+1): if(i >> j) & 1: for k in range(M): a[k] += A[j][k+1] ...
# ---------------------------- N,M,X = map(int, input().split()) A = [list(map(int, input().split(" "))) for i in range(N)] MOD = 10**9+7 a = [0]*M value = [0] ans = MOD for i in range(2**N): for j in range(N+1): if(i >> j) & 1: for k in range(M): a[k] += A[j][k+1] ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
174
#include <stdio.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m, x, c[11] = {0}, a[11][11] = {0}, y, z[11], b, d = 2e9; scanf("%d%d%d", &n, &m, &x); rep(i, n) { scanf("%d", &c[i]); rep(j, m) { scanf("%d", &a[i][j]); } } rep(i, 2) { rep(j, 2) { rep(k, 2) { ...
#include <stdio.h> //高速化したい #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m, x, c[12] = {0}, a[12][12] = {0}, y, z[12], b, d = 2e9; scanf("%d%d%d", &n, &m, &x); rep(i, n) { scanf("%d", &c[i]); rep(j, m) { scanf("%d", &a[i][j]); } } rep(i, 2) { rep(j, 2) { rep(k, 2)...
[["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["+", 0, 43, 49, 50, 49, 80, 49, 80, 81, 13], ["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
0
497
<?php fscanf(STDIN,"%d%d%d", $n,$m,$x); for($i=0; $i<$n; $i++){ $ca[$i] = explode(" ",trim(fgets(STDIN))); } $f = false; $mon = 99999999999; for($i=0; $i< 1<<$n; $i++){ $skill = array_fill(0, $m+1, 0); for($j=0; $j<$n; $j++){ if($i & (1<<$j)){ foreach($ca[$j] as $key => $data){ ...
<?php fscanf(STDIN,"%d%d%d", $n,$m,$x); for($i=0; $i<$n; $i++){ $ca[$i] = explode(" ",trim(fgets(STDIN))); } $f = false; $mon = 99999999999; for($i=0; $i< 1<<$n; $i++){ $skill = array_fill(0, $m+1, 0); for($j=0; $j<$n; $j++){ if($i & (1<<$j)){ foreach($ca[$j] as $key => $data){ ...
[["-", 0, 7, 0, 9, 0, 7, 0, 16, 17, 18], ["+", 0, 7, 0, 9, 0, 7, 0, 16, 17, 19]]
6
248
import numpy as np N, M, X = map(int, input().split()) data = [list(map(int, input().split())) for _ in range(N)] INF = float('inf') data_all = [] c_min = INF for i in range(N**2): data_tmp = [0]*M c = 0 for j in range(N): if((i>>j) & 1): for k in range(M): data_tmp[k...
import numpy as np N, M, X = map(int, input().split()) data = [list(map(int, input().split())) for _ in range(N)] INF = float('inf') data_all = [] c_min = INF for i in range(2**N): data_tmp = [0]*M c = 0 for j in range(N): if((i>>j) & 1): for k in range(M): data_tmp[k...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 22]]
5
169
#include <math.h> #include <stdio.h> int main(void) { int n, m, x; scanf("%d %d %d", &n, &m, &x); int c[n], a[n][m]; for (int i = 0; i < n; i++) { scanf("%d", &c[i]); for (int j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } int k = (int)pow(2, n); int kumi[k][n]; for (int i = 0; i...
#include <math.h> #include <stdio.h> int main(void) { int n, m, x; scanf("%d %d %d", &n, &m, &x); int c[n], a[n][m]; for (int i = 0; i < n; i++) { scanf("%d", &c[i]); for (int j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } int k = (int)pow(2, n); int kumi[k][n]; for (int i = 0; i...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 14, 8, 9, 0, 43, 39, 86, 0, 96], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22]]
0
390
// Problem : C - Skill Up // Contest : AtCoder - AtCoder Beginner Contest 167 // URL : https://atcoder.jp/contests/abc167/tasks/abc167_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cp-editor) #include <bits/stdc++.h> using namespace std; #pragma GCC optimize(...
// Problem : C - Skill Up // Contest : AtCoder - AtCoder Beginner Contest 167 // URL : https://atcoder.jp/contests/abc167/tasks/abc167_c // Memory Limit : 1024 MB // Time Limit : 2000 ms // Powered by CP Editor (https://github.com/cpeditor/cp-editor) #include <bits/stdc++.h> using namespace std; #pragma GCC optimize(...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
878
#include <bits/stdc++.h> using namespace std; int n, m, x; int c[10010]; int a[10010][10010]; const int MAX = 9999999; int money = MAX; vector<int> v; void DFS(int deep) { int he = 0; int hang[13] = {0}; for (auto weizi : v) { he += c[weizi]; for (int j = 1; j <= m; j++) { hang[j] += a[weizi][j]; ...
#include <bits/stdc++.h> using namespace std; int n, m, x; int c[10010]; int a[10010][10010]; const int MAX = 9999999; int money = MAX; vector<int> v; void DFS(int deep) { int he = 0; int hang[13] = {0}; for (auto weizi : v) { he += c[weizi]; for (int j = 1; j <= m; j++) { hang[j] += a[weizi][j]; ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
329
INF=100100100 n,m,x=map(int,input().split()) c=[] a=[] for i in range(n): t=list(map(int,input().split())) c.append(t[0]) a.append(t[1:]) cost=INF for i in range(n**2): ab=[0]*m tmp=0 for j in range(n): idx=i>>j & 1 if(idx): tmp+=c[j] for k in range(m): ...
INF=100100100 n,m,x=map(int,input().split()) c=[] a=[] for i in range(n): t=list(map(int,input().split())) c.append(t[0]) a.append(t[1:]) cost=INF for i in range(2**n): ab=[0]*m tmp=0 for j in range(n): idx=i>>j & 1 if(idx): tmp+=c[j] for k in range(m): ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 22]]
5
189
N,M,X=[int(x) for x in input().rstrip().split()] l=[] for i in range(N): ca=[int(x) for x in input().rstrip().split()] l.append(ca) A=[0 for i in range(M+2)] flag=1 ans=10**10 cnt=0 for i in range(2**N): flag=1 cost=0 for j in range(N): if i>>j & 1: now=l[N-j-1] cost+=now[0] for s in ra...
N,M,X=[int(x) for x in input().rstrip().split()] l=[] for i in range(N): ca=[int(x) for x in input().rstrip().split()] l.append(ca) A=[0 for i in range(M+2)] flag=1 ans=10**10 cnt=0 for i in range(2**N): flag=1 cost=0 for j in range(N): if i>>j & 1: now=l[N-j-1] cost+=now[0] for s in ra...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
224
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define mod 1000000007 using namespace std; using ll = long long; const ll INF = 100000000; int main() { ll n, m, x; ll c[12]; ll a[12][12]; ll res = INF; cin >> n >> m >> x; for (int i = 0; i < n; ++i) { cin >> c[i]; for (i...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define mod 1000000007 using namespace std; using ll = long long; const ll INF = 100000000; int main() { ll n, m, x; ll c[12]; ll a[12][12]; ll res = INF; cin >> n >> m >> x; for (int i = 0; i < n; ++i) { cin >> c[i]; for (i...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
253
// Jacker0031 // packages #if __has_include("extra.cpp") && __has_include(<stdint.h>) #include "extra.cpp" #else #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip>...
// Jacker0031 // packages #if __has_include("extra.cpp") && __has_include(<stdint.h>) #include "extra.cpp" #else #include <algorithm> #include <bitset> #include <cassert> #include <climits> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <iomanip>...
[["-", 0, 7, 15, 16, 12, 23, 0, 16, 17, 33], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 12, 13]]
1
804
import numpy as np N, M, X = map(int, input().split()) C = [] A = [[] for i in range(M)] resC = [] resA = list(A) NEW = 0 def update(base): #print(NEW,base) if base==None: return NEW return base + NEW def check(num): return num>=X def check2(*args): res = True for val in args: buf = (val >= X) ...
import numpy as np N, M, X = map(int, input().split()) C = [] A = [[] for i in range(M)] resC = [] resA = list(A) NEW = 0 def update(base): #print(NEW,base) if base==None: return NEW return base + NEW def check(num): return num>=X def check2(*args): res = True for val in args: buf = (val >= X) ...
[["-", 0, 1, 0, 662, 12, 658, 0, 659, 31, 22], ["+", 0, 1, 0, 662, 12, 658, 0, 659, 31, 22]]
5
316
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <set> #include <vector> #define INF 1000000000 using namespace std; int n, m, x, yes = 1, al[13], money[13], y, t, score[13][13], ans, mark[13][13], cash[13], gone[13], sum; void dfs(int i, int time) { ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <set> #include <vector> #define INF 1000000000 using namespace std; int n, m, x, yes = 1, al[13], money[13], y, t, score[13][13], ans, mark[13][13], cash[13], gone[13], sum; void dfs(int i, int time) { ...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 37, 0, 38]]
1
404
#include <iostream> #include <vector> using namespace std; long long N, M, X; vector<vector<long long>> A; vector<long long> C; long long INF = 1e18; long long dfs(int x, int i, vector<int> use) { if (i == N) { vector<long long> sum(M, 0); long long res = 0; for (int j = 0; j < N; j++) { if (use[j] ...
#include <iostream> #include <vector> using namespace std; long long N, M, X; vector<vector<long long>> A; vector<long long> C; long long INF = 1e18; long long dfs(int x, int i, vector<int> use) { if (i == N) { vector<long long> sum(M, 0); long long res = 0; for (int j = 0; j < N; j++) { if (use[j] ...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 64, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
390
from functools import reduce n, m, x = map(int, input().split()) lb = [] for i in range(n): lb.append(list(map(int, input().split()))) mincost = 10**8 for i in range(2**n): case = [0] * (m+1) for j in range(m+1): if (i >> j) & 1: case = list(map(sum, zip(case, lb[j]))) if reduce(lambda u, v: u and v, list...
from functools import reduce n, m, x = map(int, input().split()) lb = [] for i in range(n): lb.append(list(map(int, input().split()))) mincost = 10**8 for i in range(2**n): case = [0] * (m+1) for j in range(n): if (i >> j) & 1: case = list(map(sum, zip(case, lb[j]))) if reduce(lambda u, v: u and v, list(m...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
179
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) #include <bits/stdc++.h> using namespace std; int a[12][12]; int main() { int n, m, x; cin >> n >> m >> x; //参考書の値段 vector<int> c(n); //各参考書の各スキル値 for (int i = 0; i < n; i++) { cin >> c[i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) #include <bits/stdc++.h> using namespace std; int a[12][12]; int main() { int n, m, x; cin >> n >> m >> x; //参考書の値段 vector<int> c(n); //各参考書の各スキル値 for (int i = 0; i < n; i++) { cin >> c[i...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
296
#include <stdbool.h> #include <stdio.h> int main() { int n, m, x, c[12], a[12][12] = {0}; int cost = 1e9; scanf("%d%d%d", &n, &m, &x); for (int i = 0; i < n; i++) { scanf("%d", &c[i]); for (int j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } for (int bit = 0; bit < (1 << n); bit++) { i...
#include <stdbool.h> #include <stdio.h> int main() { int n, m, x, c[12], a[12][12] = {0}; int cost = 1e9; scanf("%d%d%d", &n, &m, &x); for (int i = 0; i < n; i++) { scanf("%d", &c[i]); for (int j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } for (int bit = 0; bit < (1 << n); bit++) { i...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
0
289
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG typedef long long ll; const ll INF = 9999999999; int main() { ll N, M, X; cin >> N >> M >> X; ll C[N]; ll A[N][M]; for (int i = 0; i < N; i++) { cin >> C[i]; for (int j = 0; j < M; j++) { cin >> A[i][j]; } } ll ans = I...
#include <bits/stdc++.h> using namespace std; #define _GLIBCXX_DEBUG typedef long long ll; const ll INF = 9999999999; int main() { ll N, M, X; cin >> N >> M >> X; ll C[N]; ll A[N][M]; for (int i = 0; i < N; i++) { cin >> C[i]; for (int j = 0; j < M; j++) { cin >> A[i][j]; } } ll ans = I...
[["+", 0, 7, 8, 9, 0, 43, 39, 344, 141, 78], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 18], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 47], ["-", 0, 7, 8, 9, 0, 43, 49, 80, 0, 70], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 24], ["-", 0, 7, 8, 9, 0, 43, 49, 80, 0, 73], ["+", 8, 9, 0, 43, 49, 53, 54, 55, 0, 25]]
1
274
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); int m = sc.nextInt(); int x = sc.nextInt(); int[][] c = new int[n][m + 1]; int ans = Integer.MAX_VALUE; for (...
import java.util.*; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = sc.nextInt(); int m = sc.nextInt(); int x = sc.nextInt(); int[][] c = new int[n][m + 1]; int ans = Integer.MAX_VALUE; for (...
[["+", 0, 1, 0, 11, 12, 504, 71, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 504, 71, 16, 12, 499]]
3
388
N,M,X=map(int,input().split()) C=[] A=[[] for _ in range(N)] for i in range(N): tmpA=list(map(int,input().split())) C+=[tmpA[0]] A[i]=tmpA[1:] costmin=float('inf') for k in range(2**N): tansaku=k koubai=[0 for i in range(N)] rikaido=[0 for i in range(N)] cost=0 for i in range(N-1): koubai[i]=tans...
N,M,X=map(int,input().split()) C=[] A=[[] for _ in range(N)] for i in range(N): tmpA=list(map(int,input().split())) C+=[tmpA[0]] A[i]=tmpA[1:] costmin=float('inf') for k in range(2**N): tansaku=k koubai=[0 for i in range(N)] rikaido=[0 for i in range(M)] cost=0 for i in range(N-1): koubai[i]=tans...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
266
import java.io.*; import java.util.*; public class Main { final static long MOD = 1000000007; public static String[] Ws = null; public static int wsIndx = 0; public static BufferedReader in = null; public static void main(String[] args) throws Exception { int N = nextInt(); int M = nextInt(); i...
import java.io.*; import java.util.*; public class Main { final static long MOD = 1000000007; public static String[] Ws = null; public static int wsIndx = 0; public static BufferedReader in = null; public static void main(String[] args) throws Exception { int N = nextInt(); int M = nextInt(); i...
[["+", 49, 200, 51, 227, 497, 505, 0, 16, 17, 72], ["+", 49, 200, 51, 227, 497, 505, 0, 16, 12, 499], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
750
#include <algorithm> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> a(n, vector<int>(n)); for (int i = 0; i < n; i++) { ci...
#include <algorithm> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <vector> using namespace std; int main() { 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++) { ...
[["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 22], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 21], ["+", 49, 50, 51, 4, 0, 2, 3, 4, 0, 13]]
1
291
/* STARK_BOY */ #include <bits/stdc++.h> #include <fstream> using namespace std; #define rep(i, a, b) for (ll i = a; i < b; i++) #define repe(i, a, b) for (ll i = a; i <= b; i++) #define bac(i, a, b) for (ll i = a; i >= b; i--) #define pb push_back #define mp make_pair #define F first #define S second typedef long ...
/* STARK_BOY */ #include <bits/stdc++.h> #include <fstream> using namespace std; #define rep(i, a, b) for (ll i = a; i < b; i++) #define repe(i, a, b) for (ll i = a; i <= b; i++) #define bac(i, a, b) for (ll i = a; i >= b; i--) #define pb push_back #define mp make_pair #define F first #define S second typedef long ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22], ["+", 15, 339, 51, 16, 31, 23, 0, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
433
import itertools N, M, X = map(int, input().split()) A = [] for i in range(N): A.append(list(map(int, input().split()))) saisyo = float("inf") for i in intertools.product(range(2), N): a = [0]*M gokei = 0 for j in range(N): if i[j] == 1: gokei += A[j][0] for k in range...
import itertools N, M, X = map(int, input().split()) A = [] for i in range(N): A.append(list(map(int, input().split()))) saisyo = float("inf") for i in itertools.product(range(2), repeat=N): a = [0]*M gokei = 0 for j in range(N): if i[j] == 1: gokei += A[j][0] for k in...
[["-", 0, 656, 0, 7, 12, 652, 63, 319, 500, 22], ["+", 0, 656, 0, 7, 12, 652, 63, 319, 500, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 653, 0, 32]]
5
168
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; int arr[n][m]; int cost[n]; for (int i = 0; i < n; i++) { cin >> cost[i]; for (int j = 0; j < m; j++) { cin >> arr[i][j]; } } int ans = INT_MAX; for (int q = 0; q < (1 << n); q++) { ve...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; int arr[n][m]; int cost[n]; for (int i = 0; i < n; i++) { cin >> cost[i]; for (int j = 0; j < m; j++) { cin >> arr[i][j]; } } int ans = INT_MAX; for (int q = 0; q < (1 << n); q++) { ve...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["-", 0, 57, 64, 9, 0, 7, 8, 9, 0, 45], ["-", 0, 57, 64, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
248
def main(): N, M, X = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(N)] min_total_cost = 10**9 for i in range(2**N): total_cost = 0 learned = [0] * M for j in range(N): if (i >> j) & 1: cost, points = books[j] ...
def main(): N, M, X = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(N)] min_total_cost = 10**9 for i in range(2**N): total_cost = 0 learned = [0] * M for j in range(N): if (i >> j) & 1: cost, *points = books[j] ...
[["+", 0, 1, 0, 662, 31, 684, 0, 695, 0, 48]]
5
165
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = a; i < b; i++) #define repA(i, a, b) for (int i = a; i <= b; i++) #define repD(i, b, a) for (int i = b; i >= a; i--) #define fill(a) memset(a, 0, sizeof(a)) #define f first #define s second typedef ...
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = a; i < b; i++) #define repA(i, a, b) for (int i = a; i <= b; i++) #define repD(i, b, a) for (int i = b; i >= a; i--) #define fill(a) memset(a, 0, sizeof(a)) #define f first #define s second typedef ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
309
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) using namespace std; template <class T> bool chmax(T &a, const T &b) { if (b > a) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } const long lo...
#include <bits/stdc++.h> #define rep(i, n) for (ll i = 0; i < n; i++) using namespace std; template <class T> bool chmax(T &a, const T &b) { if (b > a) { a = b; return 1; } return 0; } template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } const long lo...
[["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
432
N, M, X = map(int, input().split()) A = [list(map(int, input().split())) for i in range(N)] final = 1000000000 for i in range(1, N ** 2): ans = 0 rikai = [0]*M for j in range(N): if ((i >> j) & 1): for k in range(1, M+1): rikai[k-1] += A[j][k] ans += A[j][0]...
N, M, X = map(int, input().split()) A = [list(map(int, input().split())) for i in range(N)] final = 1000000000 for i in range(1, 2**N): ans = 0 rikai = [0]*M for j in range(N): if ((i >> j) & 1): for k in range(1, M+1): rikai[k-1] += A[j][k] ans += A[j][0] ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 22]]
5
159
n,m,x=map(int,input().split()) C=[] for i in range(n): a=list(map(int,input().split())) C.append(a) pattern=[] toBuy=[] for i in range(2**n): toBuy=[] for j in range(n): if ((i>>j)&1): toBuy.append(C[j]) # print(toBuy) pattern.append(toBuy) #print(pattern) X=[0]*m #mつのアルゴリズムそれ...
n,m,x=map(int,input().split()) C=[] for i in range(n): a=list(map(int,input().split())) C.append(a) pattern=[] toBuy=[] for i in range(2**n): toBuy=[] for j in range(n): if ((i>>j)&1): toBuy.append(C[j]) # print(toBuy) pattern.append(toBuy) #print(pattern) X=[0]*m #mつのアルゴリズムそれ...
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
254
import itertools n,m,x=map(int,input().split()) lis=tuple(tuple(map(int,input().split())) for _ in range(n)) ans=float("inf") def dfs(progress,skills,nowcost): global ans if progress==n: if all(v>=x for v in skills): ans=min(ans,nowcost) return ans dfs(progress+1,skills,nowcost)...
import itertools n,m,x=map(int,input().split()) lis=tuple(tuple(map(int,input().split())) for _ in range(n)) ans=float("inf") def dfs(progress,skills,nowcost): global ans if progress==n: if all(v>=x for v in skills): ans=min(ans,nowcost) return ans dfs(progress+1,skills,nowcost)...
[["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
176
from itertools import product N, M, X = map(int, input().split()) A = [list(map(int, input().split())) for _ in range(N)] ans = float("inf") for now in product(range(2), N): res = 0 An = [0 for _ in range(M)] for n in range(N): if now[n] == 1: res += A[n][0] An = [An[j] + A...
from itertools import product N, M, X = map(int, input().split()) A = [list(map(int, input().split())) for _ in range(N)] ans = float("inf") for now in product(range(2), repeat=N): res = 0 An = [0 for _ in range(M)] for n in range(N): if now[n] == 1: res += A[n][0] An = [An...
[["+", 0, 7, 12, 652, 3, 4, 0, 653, 141, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 653, 0, 32]]
5
171
#include <bits/stdc++.h> using namespace std; #include <numeric> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define endl "\n" #define int long long int #define mod 1000000007 #define I...
#include <bits/stdc++.h> using namespace std; #include <numeric> #define fast \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); #define endl "\n" #define int long long int #define mod 1000000007 #define I...
[["+", 0, 43, 49, 50, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 50, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
397
from itertools import product as pr n,m,x=[int(i) for i in input().split()] l=[[int(i) for i in input().split()]for j in range(n)] p=list(pr([0,1],repeat=n)) suml=[[sum([l[j][k]*i[j] for j in range(n)])for k in range(m+1)]for i in p] ans=[i[0] for i in suml if all([i[j] >=x for j in range(1,n+1)])] if len(ans)==0: pr...
from itertools import product as pr n,m,x=[int(i) for i in input().split()] l=[[int(i) for i in input().split()]for j in range(n)] p=list(pr([0,1],repeat=n)) suml=[[sum([l[j][k]*i[j] for j in range(n)])for k in range(m+1)]for i in p] ans=[i[0] for i in suml if all([i[j] >=x for j in range(1,m+1)])] if len(ans)==0: pr...
[["-", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22]]
5
172
#include <algorithm> #include <iostream> #include <vector> using namespace std; using vvi = vector<vector<int>>; const int INF = 100000000; int main() { int N, M, X; cin >> N >> M >> X; vector<int> c(N); vvi a(N, vector<int>(M)); for (int i = 0; i < N; i++) { cin >> c.at(i); for (int j = 0; j < ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; using vvi = vector<vector<int>>; const int INF = 100000000; int main() { int N, M, X; cin >> N >> M >> X; vector<int> c(N); vvi a(N, vector<int>(M)); for (int i = 0; i < N; i++) { cin >> c.at(i); for (int j = 0; j < ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 151], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 0, 57, 64, 1, 0, 16, 31, 16, 12, 22], ["+", 0, 57, 64, 1, 0, 16, 31, 16, 12, 13]]
1
305
n,m,x=map(int,input().split()) cam = [list(map(int, input().split())) for i in range(n)] ans=10000*12 for i in range(2**n): a=[0]*m cst=0 for j in range(n): bag=[] if (i>>j)&1: cst+=cam[j][0] for k in range(1,m+1): a[k-1]+=cam[j][k] if all(elem >=...
n,m,x=map(int,input().split()) cam = [list(map(int, input().split())) for i in range(n)] ans=10000**12 for i in range(2**n): a=[0]*m cst=0 for j in range(n): bag=[] if (i>>j)&1: cst+=cam[j][0] for k in range(1,m+1): a[k-1]+=cam[j][k] if all(elem >...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 578], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 31, 612], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 612], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 578]]
5
163
<?php list($N, $M, $X) = array_map(function ($n) { return (int)$n; }, explode(' ', fgets(STDIN))); $C = []; $A = []; for ($i = 0; $i < $N; $i++) { $input = array_map(function ($n) { return (int)$n; }, explode(' ', fgets(STDIN))); $C[] = array_shift($input); $A[$i] = $input; } $ans = -1; f...
<?php list($N, $M, $X) = array_map(function ($n) { return (int)$n; }, explode(' ', fgets(STDIN))); $C = []; $A = []; for ($i = 0; $i < $N; $i++) { $input = array_map(function ($n) { return (int)$n; }, explode(' ', fgets(STDIN))); $C[] = array_shift($input); $A[$i] = $input; } $ans = -1; f...
[["-", 0, 613, 3, 3, 0, 28, 0, 609, 0, 610], ["+", 0, 613, 3, 3, 0, 28, 0, 609, 0, 610], ["+", 0, 613, 3, 3, 0, 28, 0, 609, 0, 45], ["+", 3, 3, 0, 28, 0, 609, 0, 606, 0, 607], ["+", 3, 3, 0, 28, 0, 609, 0, 606, 0, 141], ["+", 0, 613, 3, 3, 0, 28, 0, 609, 0, 46]]
6
361
import numpy as np from itertools import combinations_with_replacement N,M,X = map(int,input().split()) CA = [] for i in range(N): CA.append(list(map(int,input().split()))) OK = True CA = np.array(CA) sums = np.sum(CA,axis=0) for i in range(1,M+1): if sums[i] < X: OK = False break if OK == False: print...
import numpy as np from itertools import combinations_with_replacement N,M,X = map(int,input().split()) CA = [] for i in range(N): CA.append(list(map(int,input().split()))) OK = True CA = np.array(CA) sums = np.sum(CA,axis=0) for i in range(1,M+1): if sums[i] < X: OK = False break if OK == False: print...
[["-", 0, 7, 12, 652, 3, 4, 0, 653, 141, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 653, 0, 32], ["-", 0, 7, 12, 652, 3, 4, 0, 653, 51, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
262
import numpy as np from itertools import combinations_with_replacement N,M,X = map(int,input().split()) CA = [] for i in range(N): CA.append(list(map(int,input().split()))) OK = True CA = np.array(CA) sums = np.sum(CA,axis=0) for i in range(1,M+1): if sums[i] < X: OK = False break if OK == False: print...
import numpy as np from itertools import combinations_with_replacement N,M,X = map(int,input().split()) CA = [] for i in range(N): CA.append(list(map(int,input().split()))) OK = True CA = np.array(CA) sums = np.sum(CA,axis=0) for i in range(1,M+1): if sums[i] < X: OK = False break if OK == False: print...
[["-", 8, 196, 0, 7, 12, 652, 63, 319, 500, 22], ["-", 8, 196, 0, 7, 12, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 17, 33], ["+", 0, 652, 3, 4, 0, 206, 206, 657, 12, 612]]
5
279
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define FIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout...
#include <bits/stdc++.h> #include <unordered_map> using namespace std; #define FIO \ ios_base::sync_with_stdio(0); \ cin.tie(0); \ cout...
[["-", 64, 9, 0, 7, 8, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 7, 8, 1, 0, 11, 17, 107]]
1
311
if __name__=="__main__": N, M, X = map(int, input().split(' ')) book_list = [None]*N min_price = -1 for i in range(N): book_list[i] = list(map(int, input().split(' '))) for i in range(2 ** N): comp_list = [] for j in range(N): if ((i >> j) & 1): ...
if __name__=="__main__": N, M, X = map(int, input().split(' ')) book_list = [None]*N min_price = -1 for i in range(N): book_list[i] = list(map(int, input().split(' '))) for i in range(2 ** N): comp_list = [] for j in range(N): if ((i >> j) & 1): i...
[["+", 15, 652, 3, 668, 0, 659, 12, 206, 0, 70], ["+", 3, 668, 0, 659, 12, 206, 206, 663, 0, 612], ["+", 3, 668, 0, 659, 12, 206, 206, 663, 0, 102], ["+", 15, 652, 3, 668, 0, 659, 12, 206, 0, 73], ["-", 64, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 64, 196, 0, 57, 75, 665, 15, 666, 667, 19]]
5
180
import sys lines = sys.stdin.readlines() N, M, X = map(int, lines[0].split()) A = [] C = [] for i in range(N): line = list(map(int, lines[i+1].split())) A.append(line[1:]) C.append(line[0]) # return [] def full_search(): costs = [] for i in range(2**N): vals = [0] * M cost = 0 ...
import sys lines = sys.stdin.readlines() N, M, X = map(int, lines[0].split()) A = [] C = [] for i in range(N): line = list(map(int, lines[i+1].split())) A.append(line[1:]) C.append(line[0]) # return [] def full_search(): costs = [] for i in range(2**N): vals = [0] * M cost = 0 ...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 206, 612], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 0, 73], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
229
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define FORS(i, a, b, c) for (int i = a; i < b; i += c) #define FORN(i, a, b) for (int i = a; i <= b; i++) #define FORD(i, a, b) for (int i = a - 1; i >= b; i--) #define FORE(i, b) for (auto &i : b) #define REP(i, b) FOR(i, ...
#include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = a; i < b; i++) #define FORS(i, a, b, c) for (int i = a; i < b; i += c) #define FORN(i, a, b) for (int i = a; i <= b; i++) #define FORD(i, a, b) for (int i = a - 1; i >= b; i--) #define FORE(i, b) for (auto &i : b) #define REP(i, b) FOR(i, ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
536
import itertools import numpy as np # = int(input()) N, M, X = map(int, input().split()) # = list(map(int, input().split())) # = [int(input()) for i in range(N)] CA = [list(map(int, input().split())) for i in range(N)] cost = [] skill = list(zip(*CA)) for i in range(1, M+1): if sum(skill[i]) < X: print(...
import itertools import numpy as np # = int(input()) N, M, X = map(int, input().split()) # = list(map(int, input().split())) # = [int(input()) for i in range(N)] CA = [list(map(int, input().split())) for i in range(N)] cost = [] skill = list(zip(*CA)) for i in range(1, M+1): if sum(skill[i]) < X: print(...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
182
(N,M,X),*A=$<.map{_1.split.map &:to_i} p ((0..2**N).map{|i|c,*t=A.transpose.map{|x|N.times.sum{x[_1]*i[_1]}} t.min<X&&c}-[!p]).min||-1
(N,M,X),*A=$<.map{_1.split.map &:to_i} p ((0..2**N).map{|i|c,*t=A.transpose.map{|x|N.times.sum{x[_1]*i[_1]}} t.min<X||c}-[!p]).min||-1
[["-", 31, 652, 196, 196, 8, 734, 0, 738, 17, 98], ["+", 31, 652, 196, 196, 8, 734, 0, 738, 17, 106]]
4
88
n,m,x = map(int, input().split()) l = [list(map(int, input().split())) for i in range(n)] ans = float('inf') for i in range(2**n): sum = [0]*(m+1) # n桁について調査 for j in range(n): # iのj桁目が1かどうかcheck if ((i >> j) & 1): for k in range(m+1): sum[k] += l[j][k] if su...
n,m,x = map(int, input().split()) l = [list(map(int, input().split())) for i in range(n)] ans = float('inf') for i in range(2**n): sum = [0]*(m+1) # n桁について調査 for j in range(n): # iのj桁目が1かどうかcheck if (i >> j) & 1: for k in range(m+1): sum[k] += l[j][k] if sum[...
[["-", 0, 57, 15, 23, 0, 657, 31, 23, 0, 24], ["-", 0, 7, 8, 196, 0, 57, 15, 23, 0, 25]]
5
174
from itertools import combinations from collections import deque N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] row = [i for i in range(1, N+1)] ans = float("INF") for i in range(1, N): for v in combinations(row, i): q = deque(v) cost = 0 Asum = [0]*M wh...
from itertools import combinations from collections import deque N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] row = [i for i in range(1, N+1)] ans = float("INF") for i in range(1, N+1): for v in combinations(row, i): q = deque(v) cost = 0 Asum = [0]*M ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
209
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) typedef long long ll; typedef pair<int, int> pii; const int inf = 1010001000; const ll INF = 1001000100010001000; const int mod = (int)1e9 + 7; int main() { int n, m, x; cin >> n >> m >...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define all(x) begin(x), end(x) typedef long long ll; typedef pair<int, int> pii; const int inf = 1010001000; const ll INF = 1001000100010001000; const int mod = (int)1e9 + 7; int main() { int n, m, x; cin >> n >> m >...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
334
N,M,X = map(int,input().split()) C = [] for i in range(N): C.append(list(map(int,input().split()))) cost = 100000000000000000000000 l = list(range(1,N+1)) import itertools for i in range(1,N+1): check_l = list(itertools.combinations(l,i)) for a in check_l: sub_list = [0] * (M + 1) for j in ...
N,M,X = map(int,input().split()) C = [] for i in range(N): C.append(list(map(int,input().split()))) cost = 100000000000000000000000 l = list(range(1,N+1)) import itertools for i in range(1,N+1): check_l = list(itertools.combinations(l,i)) for a in check_l: sub_list = [0] * (M + 1) for j in ...
[["-", 12, 206, 51, 206, 206, 657, 31, 206, 206, 22], ["+", 12, 206, 51, 206, 206, 657, 31, 206, 206, 22]]
5
203
$input = $stdin.read.split("\n") N,M,X = $input.shift.split(" ").map(&:to_i) $input = $input.map{|line| line.split(" ").map(&:to_i)} def ok?(ai) return false if ai.count == 0 ai.map{|a| a[1..]}.transpose.all?{|line| line.sum >= X} end all = (0...N).to_a ans = Float::INFINITY (1...N).each do |r| mss = (all.comb...
$input = $stdin.read.split("\n") N,M,X = $input.shift.split(" ").map(&:to_i) $input = $input.map{|line| line.split(" ").map(&:to_i)} def ok?(ai) return false if ai.count == 0 ai.map{|a| a[1..]}.transpose.all?{|line| line.sum >= X} end all = (0...N).to_a ans = Float::INFINITY (1..N).each do |r| mss = (all.combi...
[["-", 0, 493, 0, 652, 486, 739, 0, 475, 17, 389], ["+", 0, 493, 0, 652, 486, 739, 0, 475, 17, 757]]
4
201
from itertools import product n, m, x = list(map(int, input().split())) cl = [0] * n al = [[]*m for _ in range(n)] for i in range(n): tmp = list(map(int, input().split())) cl[i] = tmp[0] al[i] = tmp[1:] def dfs(status, book): for i in range(m): status[i] += book[i] return status ans = 10...
from itertools import product n, m, x = list(map(int, input().split())) cl = [0] * n al = [[]*m for _ in range(n)] for i in range(n): tmp = list(map(int, input().split())) cl[i] = tmp[0] al[i] = tmp[1:] def dfs(status, book): for i in range(m): status[i] += book[i] return status ans = 10...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
240
n, m, x = map(int,input().split()) l = [list(map(int,input().split())) for i in range(n)] def generate_n_bit(n): bins= [] for i in range(2**n): bins.append(list(str(format(i,'b').zfill(n)))) return bins min_price = 10**9 bins = generate_n_bit(10) bins = bins[1:] for bin in bins: a = [0 f...
n, m, x = map(int,input().split()) l = [list(map(int,input().split())) for i in range(n)] def generate_n_bit(n): bins= [] for i in range(2**n): bins.append(list(str(format(i,'b').zfill(n)))) return bins min_price = 10**9 bins = generate_n_bit(n) bins = bins[1:] for bin in bins: a = [0 fo...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
212
#include <bits/stdc++.h> using namespace std; int main() { long long N, M, X; cin >> N >> M >> X; vector<long long> C(12); vector<vector<long long>> A(12, 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]; } } for (int i = N; ...
#include <bits/stdc++.h> using namespace std; int main() { long long N, M, X; cin >> N >> M >> X; vector<long long> C(12); vector<vector<long long>> A(12, 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]; } } for (int i = N; ...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
1
934
n, m, x = map(int, input().split()) bag = {} for i in range(n): bag[i]=list(map(int, input().split())) min_ = 10**10 for bit in range(1<<n): understanding = [0 for j in range(m)] c = 0 for i in range(n): if bit & (1<<i): for k in range(m): understanding[k] += bag[i][...
n, m, x = map(int, input().split()) bag = {} for i in range(n): bag[i]=list(map(int, input().split())) min_ = 10**10 for bit in range(1<<n): understanding = [0 for j in range(m)] c = 0 for i in range(n): if bit & (1<<i): for k in range(m): understanding[k] += bag[i][...
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 48], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 17, 578]]
5
165
n, m, x = list(map(int, input().split())) c_list = [] a_matrix = [] for i in range(n): items = list(map(int, input().split())) c_list.append(items[0]) a_matrix.append(items[1:]) min_cost = 1000000 * (n+1) for i in range(2^n): cost = 0 skill_sum = [0 for _ in range(m)] bit_pattern = format(i,...
n, m, x = list(map(int, input().split())) c_list = [] a_matrix = [] for i in range(n): items = list(map(int, input().split())) c_list.append(items[0]) a_matrix.append(items[1:]) min_cost = 1000000 * (n+1) for i in range(2**n): cost = 0 skill_sum = [0 for _ in range(m)] bit_pattern = format(i...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 140], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578]]
5
219
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll INF = 1e18; // const ll MOD = 1e9+7; // const double pi = 3.14159265358979; using vl = vector<ll>; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, n) for (ll i = 1, i##_len = (n); i <= i##_len; ++i) #define rr...
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll INF = 1e18; // const ll MOD = 1e9+7; // const double pi = 3.14159265358979; using vl = vector<ll>; #define rep(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i) #define reps(i, n) for (ll i = 1, i##_len = (n); i <= i##_len; ++i) #define rr...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 33], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13]]
1
388
import itertools import numpy as np n, m, x = map(int, input().split()) san = [] for i in range(n): san.append(list(map(int, input().split()))) result = [] adds = [] for j in range(1,n+1): for conb in itertools.combinations(san, j): result.append(list(conb)) #タプルをリスト型に変換 for i in result: t = np....
import itertools import numpy as np n, m, x = map(int, input().split()) san = [] for i in range(n): san.append(list(map(int, input().split()))) result = [] adds = [] for j in range(1,n+1): for conb in itertools.combinations(san, j): result.append(list(conb)) #タプルをリスト型に変換 for i in result: t = np....
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
217
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <typeinfo> #include <utility> #include <vector> using namespace std; typedef long long int ll; t...
#include <algorithm> #include <climits> #include <cmath> #include <cstring> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <typeinfo> #include <utility> #include <vector> using namespace std; typedef long long int ll; t...
[["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22]]
1
277
import numpy as np from itertools import product if __name__ == '__main__': T = input().split() N = int(T[0]) M = int(T[1]) X = int(T[2]) price = np.zeros(N) qual = np.zeros((N, M)) for n in range(N): t = input().split() price[n] = int(t[0]) qual[n, :] = np.array([in...
import numpy as np from itertools import product if __name__ == '__main__': T = input().split() N = int(T[0]) M = int(T[1]) X = int(T[2]) price = np.zeros(N) qual = np.zeros((N, M)) for n in range(N): t = input().split() price[n] = int(t[0]) qual[n, :] = np.array([in...
[["-", 0, 57, 64, 196, 0, 57, 15, 666, 0, 531], ["+", 0, 57, 64, 196, 0, 57, 15, 666, 0, 531]]
5
223
#include <bits/stdc++.h> using namespace std; int c[20], a[20][20], p[20]; int ans = 0x7fffff; int n, m, x; void dfs(int s, int co) { if (s == n + 1) { for (int i = 1; i <= m; i++) if (p[i] < x) return; ans = min(ans, co); return; } dfs(s + 1, co); for (int i = 1; i <= m; i++) p[...
#include <bits/stdc++.h> using namespace std; int c[20], a[20][20], p[20]; int ans = INT_MAX; int n, m, x; void dfs(int s, int co) { if (s == n + 1) { for (int i = 1; i <= m; i++) if (p[i] < x) return; ans = min(ans, co); return; } dfs(s + 1, co); for (int i = 1; i <= m; i++) p[i...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 22]]
1
268
import itertools import numpy as np N,M,X=map(int, input().split()) book = [] for _ in range(N): book.append(list(map(int, input().split()))) book = np.array(book) money=pow(10,7) for i in itertools.product([0,1], repeat=N): book2=book dellist = [] for n,l in enumerate(i): if l==0: d...
import itertools import numpy as np N,M,X=map(int, input().split()) book = [] for _ in range(N): book.append(list(map(int, input().split()))) book = np.array(book) money=pow(10,7) for i in itertools.product([0,1], repeat=N): book2=book dellist = [] for n,l in enumerate(i): if l==0: d...
[["-", 0, 57, 15, 666, 0, 652, 3, 4, 0, 612], ["+", 0, 57, 15, 666, 0, 652, 3, 4, 0, 612]]
5
193
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int64_t i = 0; i < n; i++) #define REPR(i, n) for (int64_t i = n; i >= 0; i--) #define FOR(i, m, n) for (int64_t i = m; i < n; i++) #define FORR(i, m, n) for (int64_t i = m; i >= n; i--) #define ALL(v) v.begin(), v.end() typedef long long ll; templat...
#include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int64_t i = 0; i < n; i++) #define REPR(i, n) for (int64_t i = n; i >= 0; i--) #define FOR(i, m, n) for (int64_t i = m; i < n; i++) #define FORR(i, m, n) for (int64_t i = m; i >= n; i--) #define ALL(v) v.begin(), v.end() typedef long long ll; templat...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
399
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ff(i, n) for (i = 0; i < n; i++) #define pb push_back ll bg = 99824435988983; ll power(ll x, ll y) { if (y == 0) return 1; ll d = power(x, y / 2); ll f = (d * d); if (y % 2 == 0) return f; else return (f * x); } ll is(l...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define ff(i, n) for (i = 0; i < n; i++) #define pb push_back ll bg = 99824435988983; ll power(ll x, ll y) { if (y == 0) return 1; ll d = power(x, y / 2); ll f = (d * d); if (y % 2 == 0) return f; else return (f * x); } ll is(l...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
360
import itertools n, m, x = map(int, input().split()) T = [list(map(int, input().split())) for _ in range(n)] flag1 = True ans = -1 for i in range(1, n + 1): if i == 1: for j in range(n): flag = True for k in range(m): if T[j][k + 1] < x: flag = F...
import itertools n, m, x = map(int, input().split()) T = [list(map(int, input().split())) for _ in range(n)] flag1 = True ans = -1 for i in range(1, n + 1): if i == 1: for j in range(n): flag = True for k in range(m): if T[j][k + 1] < x: flag = F...
[["+", 0, 662, 12, 652, 3, 4, 0, 206, 0, 70], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 206, 612], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 0, 73]]
5
309
import numpy as np from itertools import combinations N, M, X = map(int, input().split()) row_list = [] C_list = [] for _ in range(N): row = list(map(int, input().split())) row = np.array(row) C_list.append(row[0]) row_list.append(row[1:]) def check(subset, C_list, row_list, X): if len(subset) == 0: ...
import numpy as np from itertools import combinations N, M, X = map(int, input().split()) row_list = [] C_list = [] for _ in range(N): row = list(map(int, input().split())) row = np.array(row) C_list.append(row[0]) row_list.append(row[1:]) def check(subset, C_list, row_list, X): if len(subset) == 0: ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
226
n, m, x = map(int, input().split()) A = [] for i in range(n): A.append(list(map(int, input().split()))) # print(A) ans = float("inf") for i in range(2 ** n): skill = [0] * (m+1) for j in range(n): if ((i >> j) & 1): for k in range(m): skill[k] += A[j][k] # print(...
n, m, x = map(int, input().split()) A = [] for i in range(n): A.append(list(map(int, input().split()))) # print(A) ans = float("inf") for i in range(2 ** n): skill = [0] * (m+1) for j in range(n): if ((i >> j) & 1): for k in range(m+1): skill[k] += A[j][k] # prin...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
176
N, M, X = input().split() C, A = [], [] for _ in range(N): tmp = [int(a) for a in input().split()] C.append(tmp[0]) A.append(tmp[1:]) mi = 1 << 100 for binary in range(1 << N): B = [0] * M c = 0 for i in range(N): if binary >> N & 1: c += C[i] for j in range(M): ...
N, M, X = map(int, input().split()) C, A = [], [] for _ in range(N): tmp = [int(a) for a in input().split()] C.append(tmp[0]) A.append(tmp[1:]) mi = 1 << 100 for binary in range(1 << N): B = [0] * M c = 0 for i in range(N): if binary >> i & 1: c += C[i] for j in ...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 25], ["-", 8, 196, 0, 57, 15, 657, 31, 657, 12, 22], ["+", 8, 196, 0, 57, 15, 657, 31, 657, 12, 22]]
5
162
N, M, X = map(int, input().split()) A, C = [], [] for _ in range(N): tmp = input().split() C.append(int(tmp[0])) A.append([int(i) for i in tmp[1:]]) is_clear = False min_cost = 10**10 for flg_number in range(2 ** N - 1): flgs = format(flg_number, '0'+str(N)+'b') thr = [X] * M cost = 0 for i ...
N, M, X = map(int, input().split()) A, C = [], [] for _ in range(N): tmp = input().split() C.append(int(tmp[0])) A.append([int(i) for i in tmp[1:]]) is_clear = False min_cost = 10**10 for flg_number in range(2 ** N): flgs = format(flg_number, '0'+str(N)+'b') thr = [X] * M cost = 0 for i in r...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
219
DEBUG = False N, M, X = map(int, input().split()) A = [] C = [] for _ in range(N): CA = list(map(int, input().split())) C.append(CA[0]) A.append(CA[1::]) if DEBUG: print(A) print(C) max_money = 10**5 * N ans_money = max_money # ans_algorythm = None for i in range(2**N): bit = bin(i)[2::] ...
DEBUG = False N, M, X = map(int, input().split()) A = [] C = [] for _ in range(N): CA = list(map(int, input().split())) C.append(CA[0]) A.append(CA[1::]) if DEBUG: print(A) print(C) max_money = 10**5 * N + 1 ans_money = max_money # ans_algorythm = None for i in range(2**N): bit = bin(i)[2::] ...
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
269
from itertools import combinations def main(): N, M, X = [int(i) for i in input().split()] C, A = [], [] for _ in range(N): ca = [int(i) for i in input().split()] C.append(ca[0]) A.append(ca[1:]) for m in range(M): if sum(a[m] for a in A) < X: print(-1) ...
from itertools import combinations def main(): N, M, X = [int(i) for i in input().split()] C, A = [], [] for _ in range(N): ca = [int(i) for i in input().split()] C.append(ca[0]) A.append(ca[1:]) for m in range(M): if sum(a[m] for a in A) < X: print(-1) ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612]]
5
272
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define dunk(n) cout << n << endl #define all(v) v.begin(), v.end() typedef long long ll; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n, vector<int>(m)); vector<int>...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define dunk(n) cout << n << endl #define all(v) v.begin(), v.end() typedef long long ll; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n, vector<int>(m)); vector<int>...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
267
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const double PI = acos(-1); const int INF = numeric_limits<int>::max(); int main() { int n, m, x; cin >> n >> m >> x; int...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep1(i, n) for (int i = 1; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const double PI = acos(-1); const int INF = numeric_limits<int>::max(); int main() { int n, m, x; cin >> n >> m >> x; int...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
353
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd from itertools import permutations, combinations, product, accumulate, combinations_with_replacement from operator import itemgetter, mul from co...
import sys, re, os from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd from itertools import permutations, combinations, product, accumulate, combinations_with_replacement from operator import itemgetter, mul from co...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
491
import numpy as np from itertools import product INF = 10**9 N, M, X = map(int, input().split()) C = [None]*N A = [None]*N for i in range(N): line = list(map(int, input().split())) C[i] = line[0] A[i] = np.array(line[1:]) choose = [True, False] min_price = INF for s in product([True, False], repeat=N): ...
import numpy as np from itertools import product INF = 10**9 N, M, X = map(int, input().split()) C = [None]*N A = [None]*N for i in range(N): line = list(map(int, input().split())) C[i] = line[0] A[i] = np.array(line[1:]) choose = [True, False] min_price = INF for s in product([True, False], repeat=N): ...
[["-", 8, 196, 0, 57, 15, 657, 31, 657, 17, 152], ["+", 0, 7, 8, 196, 0, 57, 15, 206, 0, 70], ["-", 0, 7, 8, 196, 0, 57, 15, 657, 17, 67], ["-", 0, 7, 8, 196, 0, 57, 15, 657, 12, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 206, 0, 73]]
5
202
import numpy as np import sys from itertools import chain, combinations N, M, X = [int(n) for n in input().split()] matrix = np.zeros((N,M+1)) for i in range(N): matrix[i] = np.array([int(n) for n in input().split()]) total = np.sum(matrix[:,1:],axis=0) if not all(i >= X for i in total): print(-1) sys.ex...
import numpy as np import sys from itertools import chain, combinations N, M, X = [int(n) for n in input().split()] matrix = np.zeros((N,M+1)) for i in range(N): matrix[i] = np.array([int(n) for n in input().split()]) total = np.sum(matrix[:,1:],axis=0) if not all(i >= X for i in total): print(-1) sys.ex...
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 48]]
5
263
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int X = sc.nextInt(); int[] C = new int[N]; int[][] A = new int[N][M]; boolean possibility = false; int min = 0; for (int i...
import java.util.*; class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int M = sc.nextInt(); int X = sc.nextInt(); int[] C = new int[N]; int[][] A = new int[N][M]; boolean possibility = false; int min = 0; for (int i...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22]]
3
403
n,k,x = (int(x) for x in input().split()) C = [] A = [] for i in range(n): list = [int(i) for i in input().split()] C.append(list[0]) A.append(list[1:]) i = 0 case = [0]*(2**n) chk = [] for i in range(2**n): chk.append([0]*m) i = 0 for i in range(2 ** n): for j in range(n): # このループが一番のポイント ...
n,m,x = (int(x) for x in input().split()) C = [] A = [] for i in range(n): list = [int(i) for i in input().split()] C.append(list[0]) A.append(list[1:]) i = 0 case = [0]*(2**n) chk = [] for i in range(2**n): chk.append([0]*m) i = 0 for i in range(2 ** n): for j in range(n): if ((i >> j) & 1)...
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22]]
5
270
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from itertools import product n, m, x = map(int, readline().split()) ca = [list(map(int, readline().split())) for _ in range(n)] ans = float('inf') for bit in product([0, ...
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(10 ** 7) from itertools import product n, m, x = map(int, readline().split()) ca = [list(map(int, readline().split())) for _ in range(n)] ans = float('inf') for bit in product([0, ...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
211
import bisect import heapq import itertools import math from collections import Counter, defaultdict, deque from copy import deepcopy from decimal import Decimal from math import gcd from operator import add, itemgetter, mul, xor def cmb(n,r,mod): bunshi=1 bunbo=1 for i in range(r): bunbo = bunbo*(i+1)%mod ...
import bisect import heapq import itertools import math from collections import Counter, defaultdict, deque from copy import deepcopy from decimal import Decimal from math import gcd from operator import add, itemgetter, mul, xor def cmb(n,r,mod): bunshi=1 bunbo=1 for i in range(r): bunbo = bunbo*(i+1)%mod ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["-", 36, 36, 36, 36, 0, 656, 0, 57, 0, 121], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
397
from itertools import combinations import numpy as np N,M,X=map(int, input().split()) list_=[list(map(int, input().split())) for _ in range(N)] gokei=X cost=100001 list_C=[] for i in range(N): list_C=np.array(list(combinations(list_,N-i))) count=0 #print(list_C) for h in range(len(list_C)): if all(np.sum(list_C...
from itertools import combinations import numpy as np N,M,X=map(int, input().split()) list_=[list(map(int, input().split())) for _ in range(N)] cost=100000001 list_C=[] for i in range(N): list_C=np.array(list(combinations(list_,N-i))) count=0 #print(list_C) for h in range(len(list_C)): if all(np.sum(list_C[h], ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 652, 3, 4, 0, 41, 0, 666, 0, 612], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 0, 612], ["-",...
5
186
#include <bits/stdc++.h> #define ll long long #define pb push_back #define c(P) cout << P << "\n" #define pii pair<ll, ll> #define mi map<ll, ll> #define mii map<pii, ll> #define F first #define S second #define sz(a) (ll)(a.size()) #define cr(P) \ cout...
#include <bits/stdc++.h> #define ll long long #define pb push_back #define c(P) cout << P << "\n" #define pii pair<ll, ll> #define mi map<ll, ll> #define mii map<pii, ll> #define F first #define S second #define sz(a) (ll)(a.size()) #define cr(P) \ cout...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 31, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 31, 22], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 31, 22], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 17, 152], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 31, 13...
1
386
#include <bits/stdc++.h> #include <cmath> #include <iostream> #include <stdio.h> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; const ll MAX = 1000000; const ll MOD = 1000000007; ll fac[MAX]; // テーブルを作る前処理 /* void COMinit() { fac[0] = fac[1] = 1; fo...
#include <bits/stdc++.h> #include <cmath> #include <iostream> #include <stdio.h> #include <vector> #define rep(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; const ll MAX = 1000000; const ll MOD = 1000000007; ll fac[MAX]; // テーブルを作る前処理 /* void COMinit() { fac[0] = fac[1] = 1; fo...
[["-", 0, 7, 15, 16, 12, 23, 0, 16, 12, 22], ["+", 0, 7, 15, 16, 12, 23, 0, 16, 12, 22]]
1
453
#include <bits/stdc++.h> using namespace std; #define MP make_pair #define PB push_back #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for (int i = 0; i < (n); i++) #define REP1(i, n) for (int i = 1; i < (n); i++) #define REP2(i, d, n) for (int i = (d); i < (n); i++) #define RREP(i, n) for (int i = (n); i >= ...
#include <bits/stdc++.h> using namespace std; #define MP make_pair #define PB push_back #define ALL(x) (x).begin(), (x).end() #define REP(i, n) for (int i = 0; i < (n); i++) #define REP1(i, n) for (int i = 1; i < (n); i++) #define REP2(i, d, n) for (int i = (d); i < (n); i++) #define RREP(i, n) for (int i = (n); i >= ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
387
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { int N, M; long X; cin >> N >> M >> X; long C[N]; long A[N][M]; for (int i = 0; i < N; i++) { cin >> C[i]; for (int j = 0; j < M; j++) { cin >> A[i][j]; } } vector<long long> z(M, 0); for (int i = 0; i...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { int N, M; long X; cin >> N >> M >> X; long C[N]; long A[N][M]; for (int i = 0; i < N; i++) { cin >> C[i]; for (int j = 0; j < M; j++) { cin >> A[i][j]; } } vector<long long> z(M, 0); for (int i = 0; i...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22]]
1
332
/* Simplicity and Goodness */ #include <bits/stdc++.h> using namespace std; #define scn(n) scanf("%d", &n) #define lscn(n) scanf("%lld", &n) #define lpri(n) printf("%lld ", n) #define pri(n) printf("%d ", (int)n) #define prin(n) printf("%d\n", (int)n) #define lprin(n) printf("%lld\n", n) #define deb(x) cout << #x << '...
/* Simplicity and Goodness */ #include <bits/stdc++.h> using namespace std; #define scn(n) scanf("%d", &n) #define lscn(n) scanf("%lld", &n) #define lpri(n) printf("%lld ", n) #define pri(n) printf("%d ", (int)n) #define prin(n) printf("%d\n", (int)n) #define lprin(n) printf("%lld\n", n) #define deb(x) cout << #x << '...
[["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22]]
1
340
#include <bits/stdc++.h> using namespace std; #define rep(i, cc, n) for (int i = cc; i < n; ++i) #define lrep(i, cc, n) for (long long i = cc; i < n; ++i) #define rrep(i, cc, n) for (long i = cc; i > n; --i) using ll = long long; int main() { ll n, m, x; cin >> n >> m >> x; vector<vector<ll>> book(n); vector<l...
#include <bits/stdc++.h> using namespace std; #define rep(i, cc, n) for (int i = cc; i < n; ++i) #define lrep(i, cc, n) for (long long i = cc; i < n; ++i) #define rrep(i, cc, n) for (long i = cc; i > n; --i) using ll = long long; int main() { ll n, m, x; cin >> n >> m >> x; vector<vector<ll>> book(n); vector<l...
[["-", 8, 9, 0, 9, 0, 57, 64, 9, 0, 46], ["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 46]]
1
289
n, m, x = list(map(int, input().split())) cas = [] for i in range(n): ca = list(map(int, input().split())) cas.append(ca) kingakumin = 10000000000 for i in range(2 ** n): now = [] inow = i for j in range(n): now.append(i % 2) i = i // 2 syuutoku = [] for j in range(m): ...
n, m, x = list(map(int, input().split())) cas = [] for i in range(n): ca = list(map(int, input().split())) cas.append(ca) kingakumin = 10000000000 for i in range(2 ** n): now = [] inow = i for j in range(n): now.append(i % 2) i = i // 2 syuutoku = [] for j in range(m): ...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 64, 196, 0, 1, 0, 662, 12, 664, 28, 612]]
5
216