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
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; long long n, m, x; long long XX[12]; void init_XX() { for (long long i = 0; i < m; i++) { XX[i] = 0; } } int main() { cin >> n >> m >> x; long long a[n][m...
#include <algorithm> #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <set> #include <vector> using namespace std; long long n, m, x; long long XX[12]; void init_XX() { for (long long i = 0; i < m; i++) { XX[i] = 0; } } int main() { cin >> n >> m >> x; long long a[n][m...
[["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
365
n, m, x = map(int, input().split()) cl = list(list(map(int, input().split())) for _ in range(n)) ans = float('inf') for i in range(2**n): tmp = [0]*(m-1) cost = 0 for j in range(n): if (i >> j) & 1: for k in range(m-1): tmp[k] += cl[j][k+1] cost += cl[j][0] ...
n, m, x = map(int, input().split()) cl = list(list(map(int, input().split())) for _ in range(n)) ans = float('inf') for i in range(2**n): tmp = [0]*m cost = 0 for j in range(n): if (i >> j) & 1: for k in range(m): tmp[k] += cl[j][k+1] cost += cl[j][0] for...
[["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["-", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
169
#include <algorithm> #include <iostream> #include <vector> typedef long long ll; using namespace std; ll inf = 1000000007; ll c[55]; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<ll>> a(n); for (int i = 0; i < n; i++) { cin >> c[i]; a[i].resize(m); for (int j = 0; j < m; j++) { c...
#include <algorithm> #include <iostream> #include <vector> typedef long long ll; using namespace std; ll inf = 1000000007; ll c[55]; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<ll>> a(n); for (int i = 0; i < n; i++) { cin >> c[i]; a[i].resize(m); for (int j = 0; j < m; j++) { c...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
302
#include <algorithm> #include <iostream> #include <vector> typedef long long ll; using namespace std; ll inf = 1000000007; ll c[55]; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n); for (int i = 0; i < n; i++) { cin >> c[i]; a[i].resize(m); for (int j = 0; j < m; j++) { ...
#include <algorithm> #include <iostream> #include <vector> typedef long long ll; using namespace std; ll inf = 1000000007; ll c[55]; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n); for (int i = 0; i < n; i++) { cin >> c[i]; a[i].resize(m); for (int j = 0; j < m; j++) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
299
from itertools import combinations import numpy as np n,m,x = map(int, input().split()) costs = [] understnding = [] ans = 10 ** 20 for _ in range(n): tmp = list(map(int, input().split())) costs.append(tmp[0]) understnding.append(tmp[1:]) costs = np.array(costs) understnding = np.array(understnding) ...
from itertools import combinations import numpy as np n,m,x = map(int, input().split()) costs = [] understnding = [] ans = 10 ** 20 for _ in range(n): tmp = list(map(int, input().split())) costs.append(tmp[0]) understnding.append(tmp[1:]) costs = np.array(costs) understnding = np.array(understnding) ...
[["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 12, 23, 0, 657, 12, 652, 3, 4, 0, 22], ["+", 12, 23, 0, 657, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
229
#include <bits/stdc++.h> using namespace std; #define repr(i, a, b) for (int i = a; i < b; i++) #define rep(i, n) for (int i = 0; i < n; i++) template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < ...
#include <bits/stdc++.h> using namespace std; #define repr(i, a, b) for (int i = a; i < b; i++) #define rep(i, n) for (int i = 0; i < n; i++) template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
498
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int powN = (int)(Math.pow(2, N) + 0.5); int M = scan.nextInt(); int X = scan.nextInt(); int f = 0; int total[] = new int[M + 1]; int...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int powN = (int)(Math.pow(2, N) + 0.5); int M = scan.nextInt(); int X = scan.nextInt(); int f = 0; int total[] = new int[M + 1]; int...
[["-", 8, 196, 0, 57, 15, 15, 0, 16, 17, 47], ["+", 8, 196, 0, 57, 15, 15, 0, 16, 17, 20]]
3
504
#include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <sstream> #include <vector> using std::cin; using std::cout; using std::endl; using std::flush; namespace Util { using StringVector = std::vector<std::string>; /* @ 目的: 文字列分割 */ StringVector split(const std::string &s, ...
#include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <sstream> #include <vector> using std::cin; using std::cout; using std::endl; using std::flush; namespace Util { using StringVector = std::vector<std::string>; /* @ 目的: 文字列分割 */ StringVector split(const std::string &s, ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
717
#include <stdio.h> void zeros(int *a); int p(int a, int b); int main(void) { int n = 0, m = 0, x = 0, price = 0, min = 1200001, count = 1; int c[12] = {}, A[12][12] = {}, total[12] = {}; 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++) { ...
#include <stdio.h> void zeros(int *a); int p(int a, int b); int main(void) { int n = 0, m = 0, x = 0, price = 0, min = 1200001, count = 1; int c[12] = {}, A[12][12] = {}, total[12] = {}; 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++) { ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 7, 15, 16, 12, 2, 3, 4, 0, 22], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 22]]
0
407
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> const int MAX = 1001001001; int main() { int N, M, X; std::cin >> N >> M >> X; std::vector<int> C(N); std::vector<std::vector<int>> A(N, std::vector<int>(N)); for (int i = 0; i < N; i++) { s...
#include <algorithm> #include <iostream> #include <queue> #include <string> #include <utility> #include <vector> const int MAX = 1001001001; int main() { int N, M, X; std::cin >> N >> M >> X; std::vector<int> C(N); std::vector<std::vector<int>> A(N, std::vector<int>(M)); for (int i = 0; i < N; i++) { s...
[["-", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78], ["+", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78]]
1
311
import numpy as np N, M, X = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(N)] cost = float("inf") for i in range(2**N): tmp = np.array([0 for _ in range(M+1)]) for j in range(N): if (i>>j) & 1: tmp += np.array(C[j]) if min(tmp[1:]) >= 10: cost = min(cost, tmp[0]) ...
import numpy as np N, M, X = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(N)] cost = float("inf") for i in range(2**N): tmp = np.array([0 for _ in range(M+1)]) for j in range(N): if (i>>j) & 1: tmp += np.array(C[j]) if min(tmp[1:]) >= X: cost = min(cost, tmp[0]) p...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
152
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { const int max = 1000000; int n, m, x, ans = max; cin >> n >> m >> x; vector<vector<int>> a(n, vector<int>(m)); vector<int> c(n), alg(m); rep(i, n) { c...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using P = pair<int, int>; int main() { const int max = 10000000; int n, m, x, ans = max; cin >> n >> m >> x; vector<vector<int>> a(n, vector<int>(m)); vector<int> c(n), alg(m); rep(i, n) { ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
279
N, M, X = map(int, input().split()) C = [] A = [] for _ in range(N): l = list(map(int, input().split())) C.append(l[0]) A.append(l[1:]) ans = -1 for i in range((1<<N)-1): u = [0] * M p = 0 for j in range(N): if i & (1 << j): p += C[j] for k in range(M): ...
N, M, X = map(int, input().split()) C = [] A = [] for _ in range(N): l = list(map(int, input().split())) C.append(l[0]) A.append(l[1:]) ans = -1 for i in range((1<<N)): u = [0] * M p = 0 for j in range(N): if i & (1 << j): p += C[j] for k in range(M): ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
166
import itertools as it N, M, X = map(int, input().split()) book = [[int(_) for _ in input().split()] for i in range(N)] combs = it.product([0, 1], repeat=N) prices = [] for comb in combs: # print(comb) bag = [0] * M+1 for i in range(N): if comb[i] == 0: continue else: ...
import itertools as it N, M, X = map(int, input().split()) book = [[int(_) for _ in input().split()] for i in range(N)] combs = it.product([0, 1], repeat=N) prices = [] for comb in combs: # print(comb) bag = [0] * (M+1) for i in range(N): if comb[i] == 0: continue else: ...
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
171
import itertools as it N,M,X=map(int,input().split()) book = [[int(_) for _ in input().split()] for i in range(N)] combs = it.product([0, 1], repeat=N) prices = [] for comb in combs: bag = [0] * M for i in range(N): if comb[i] == 0: continue else: for j in range(M): bag[j]+=book[i][j] if min(bag[1:])...
import itertools as it N,M,X=map(int,input().split()) book = [[int(_) for _ in input().split()] for i in range(N)] combs = it.product([0, 1], repeat=N) prices = [] for comb in combs: bag = [0] * (M+1) for i in range(N): if comb[i] == 0: continue else: for j in range(M+1): bag[j]+=book[i][j] if min(ba...
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
166
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<ll>>; int main() { ll N, K, b; cin >> N >> K >> b; vector<vector<ll>> vec(N, vector<ll>(K + 1)); ll d = 0; for (ll i = 0; i < N; i++) { for (ll j = 0; j < K + 1; j++) { cin >> vec.at(i).at(j); } d...
#include <bits/stdc++.h> using namespace std; using ll = long long; using Graph = vector<vector<ll>>; int main() { ll N, K, b; cin >> N >> K >> b; vector<vector<ll>> vec(N, vector<ll>(K + 1)); ll d = 0; for (ll i = 0; i < N; i++) { for (ll j = 0; j < K + 1; j++) { cin >> vec.at(i).at(j); } d...
[["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13]]
1
331
N,M,X = map(int, input().split()) A = [] C = [] for i in range(N) : I = list(map(int,input().split())) C.append(I[0]) A.append(I[1:]) ans = 10**12 for iv in range(1 << N) : r = [0] * M c = 0 isOk = True for i in range(N) : if(not iv >> i & 1) : continue c += C[i]...
N,M,X = map(int, input().split()) A = [] C = [] for i in range(N) : I = list(map(int,input().split())) C.append(I[0]) A.append(I[1:]) ans = 10**12 for iv in range(1 << N) : r = [0] * M c = 0 isOk = True for i in range(N) : if(not iv >> i & 1) : continue c += C[i]...
[["-", 0, 57, 15, 23, 0, 666, 0, 657, 12, 612], ["+", 0, 57, 15, 23, 0, 666, 0, 657, 12, 612]]
5
194
import numpy as np N,M,X=map(int,input().split()) allList=[] for _ in range(N): allList.append(np.array(list(map(int,input().split())))) minnum=10**7 for i in range(2**N): skill=[0]*(M+1) flag=True for row in range(N): if i&(2**row)>0: skill+=allList[row] for i in range(M): ...
import numpy as np N,M,X=map(int,input().split()) allList=[] for _ in range(N): allList.append(np.array(list(map(int,input().split())))) minnum=10**7 for i in range(2**N): skill=[0]*(M+1) flag=True for row in range(N): if i&(2**row)>0: skill+=allList[row] for j in range(M): ...
[["-", 0, 656, 0, 7, 8, 196, 0, 7, 31, 22], ["+", 0, 656, 0, 7, 8, 196, 0, 7, 31, 22]]
5
163
import sys input = sys.stdin.readline def find_good( list , x ): #if ok : return 1 , not ok : return 0 flag = 1 for i in list: if i < x: flag = 0 break return flag def main(): n,m,x = map( int , input().split() ) a = [] c = [] for i in range(n): ...
import sys input = sys.stdin.readline def find_good( list , x ): #if ok : return 1 , not ok : return 0 flag = 1 for i in list: if i < x: flag = 0 break return flag def main(): n,m,x = map( int , input().split() ) a = [] c = [] for i in range(n): ...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 20]]
5
237
#include <bits/stdc++.h> using namespace std; vector<int> c, d; vector<vector<int>> a; int n, m, x, sum = 0, res = 1200001; int search(int cnt) { if (cnt >= n) { bool solve = true; --cnt; for (int i = 0; i < m; ++i) solve &= (d[i] >= x); if (solve == true) return sum; else return...
#include <bits/stdc++.h> using namespace std; vector<int> c, d; vector<vector<int>> a; int n, m, x, sum = 0, res = 1200001; int search(int cnt) { if (cnt >= n) { bool solve = true; --cnt; for (int i = 0; i < m; ++i) solve &= (d[i] >= x); if (solve == true) return sum; else return...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
342
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { /* Input */ int N, M, X; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N, vector<int>(M)); rep(i, N) { cin >> C.at(i); rep(j, M) { cin >> A.at(i).at(j); } } /* Main Lo...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int main() { /* Input */ int N, M, X; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N, vector<int>(M)); rep(i, N) { cin >> C.at(i); rep(j, M) { cin >> A.at(i).at(j); } } /* Main Lo...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 13], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 48], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
278
#include <bits/stdc++.h> using namespace std; 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.at(i); for (int j = 0; j < m; j++) { cin >> a.at(i).at(j); } } long long...
#include <bits/stdc++.h> using namespace std; 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.at(i); for (int j = 0; j < m; j++) { cin >> a.at(i).at(j); } } long long...
[["-", 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
303
N, M, X = map(int, input().split()) A = [list(map(int, input().split())) for _ in range(N)] ans = 10**9 + 10 for i in range(N**2): money = 0 L = [0] * M for j in range(N): if (i >> j) & 1: money += A[j][0] for k in range(M): L[k] += A[j][k+1] if min(L) >...
N, M, X = map(int, input().split()) A = [list(map(int, input().split())) for _ in range(N)] ans = 10**9 + 10 for i in range(1, 2**N): money = 0 L = [0] * M for j in range(N): if (i >> j) & 1: money += A[j][0] for k in range(M): L[k] += A[j][k+1] if min(L...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 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, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 22]]
5
151
#include <bits/stdc++.h> using namespace std; int main() { long int n, m, i, j, k, min, x, temp, sw; temp = 0; sw = 0; min = 200000; cin >> n >> m >> x; long int c[n], a[n][m], sum[m]; for (i = 0; i < n; ++i) { cin >> c[i]; for (j = 0; j < m; j++) { cin >> a[i][j]; } } for (j = 0; ...
#include <bits/stdc++.h> using namespace std; int main() { long int n, m, i, j, k, min, x, temp, sw; temp = 0; sw = 0; min = 20000000; cin >> n >> m >> x; long int c[n], a[n][m], sum[m]; for (i = 0; i < n; ++i) { cin >> c[i]; for (j = 0; j < m; j++) { cin >> a[i][j]; } } for (j = 0...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
313
N, M, X = map(int, input().split()) INF = 30 ans = 1 << INF data = [] for i in range(N): c = list(map(int, input().split())) data.append(c) for i in range(1, 2**N): tmp = 0 skill = [0] * M for j in range(N): if i >> j & 1: tmp += data[j][0] for k in range(M): ...
N, M, X = map(int, input().split()) INF = 30 ans = 1 << INF data = [] for i in range(N): c = list(map(int, input().split())) data.append(c) for i in range(1, 2**N): tmp = 0 skill = [0] * M for j in range(N): if i >> j & 1: tmp += data[j][0] for k in range(M): ...
[["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72]]
5
163
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1 << 30; const ll LINF = 1LL << 60; #define int long long signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, X; cin >> n >> m >> X; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m)); for (int i...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int INF = 1 << 30; const ll LINF = 1LL << 60; #define int long long signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m, X; cin >> n >> m >> X; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m)); for (int i...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
303
n,m,x=map(int,input().split()) a=[] c=[] inf=10**9 result=inf for i in range(n): b=list(map(int,input().split())) c.append(b[0]) a.append(b[1:]) for i in range(1<<n): cnt=0 rikaido=[0]*m for j in range(n): if (i>>j)&1: for k in range(m): rikaido[k]+=a[j][k] cnt+=c[j] ...
n,m,x=map(int,input().split()) a=[] c=[] inf=10**9 result=inf for _ in range(n): books=list(map(int,input().split())) c.append(books[0]) a.append(books[1:]) for i in range(1<<n): cnt=0 rikaido=[0]*m for j in range(n): if (i>>j)&1: for k in range(m): rikaido[k]+=a[j][k] cnt...
[["-", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 7, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 206, 51, 22]]
5
176
N, M, X = map(int, input().split()) C = [(list(map(int, input().split()))) for _ in range(N)] # bit全探索を行い、参考書に関する全ての組みについて、値段と理解度を求める ans = 10**10 for i in range(2**N): U = [0]*(M+1) for j in range(N): if ((i >> j) & 1): for k in range(M+1): U[k] += C[j][k] # ある組みが条件を満たすなら、その値段をvalに追加 if ...
N, M, X = map(int, input().split()) C = [(list(map(int, input().split()))) for _ in range(N)] # bit全探索を行い、参考書に関する全ての組みについて、値段と理解度を求める ans = 10**10 for i in range(2**N): U = [0]*(M+1) for j in range(N): if ((i >> j) & 1): for k in range(M+1): U[k] += C[j][k] # ある組みが条件を満たすなら、その値段をvalに追加 if ...
[["-", 0, 662, 12, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 51, 22]]
5
164
N, M, X = map(int, input().split(' ')) price, exp, rst = [], [ [] for i in range(M)], -1 for i in range(N): ls = list(map(int, input().split(' '))) price.append(ls[0]) exp[i] = ls[1:] for i in range(1 << N): price_combi, exp_combi, exp_sum, cnt_ls = [], [], [0] * M, [] for j in range(N): if ...
N, M, X = map(int, input().split(' ')) price, exp, rst = [], [ [] for i in range(N) ], -1 for i in range(N): ls = list(map(int, input().split(' '))) price.append(ls[0]) exp[i] = ls[1:] for i in range(1 << N): price_combi, exp_combi, exp_sum, cnt_ls = [], [], [0] * M, [] for j in range(N): if...
[["-", 0, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 0, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
231
#include <bits/stdc++.h> using namespace std; bool provera(vector<long long> &niz, int &m, long long &x) { for (int i = 0; i < m; i++) if (niz[i] < x) return false; return true; } long long f(vector<vector<long long>> &v, vector<long long> &cene, int &n, int &m, long long &x, vector<long lon...
#include <bits/stdc++.h> using namespace std; bool provera(vector<long long> &niz, int &m, long long &x) { for (int i = 0; i < m; i++) if (niz[i] < x) return false; return true; } long long f(vector<vector<long long>> &v, vector<long long> &cene, int &n, int &m, long long &x, vector<long lon...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
402
N, M, X = map(int, input().split()) C = [] A = [] for i in range(N): c = list(map(int, input().split())) C.append(c[0]) A.append(c[1:]) ans = sum(C) for n in range(1 << N): p = [0 for j in range(M)] q = 0 for i in range(N): t = (n >> i) & 1 q += t * C[i] for j in range(M): p[j] += t * A[i]...
N, M, X = map(int, input().split()) C = [] A = [] for i in range(N): c = list(map(int, input().split())) C.append(c[0]) A.append(c[1:]) ans = sum(C) + 1 for n in range(1 << N): p = [0 for j in range(M)] q = 0 for i in range(N): t = (n >> i) & 1 q += t * C[i] for j in range(M): p[j] += t * ...
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47]]
5
203
#include <algorithm> #include <iostream> #include <math.h> #include <vector> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } int main() { ll n, m, x; cin >> n >> m >> x; vector<ll> C(n); ll A[12][12]; for (int i = ...
#include <algorithm> #include <iostream> #include <math.h> #include <vector> using namespace std; typedef long long ll; ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } int main() { ll n, m, x; cin >> n >> m >> x; vector<ll> C(n); ll A[12][12]; for (int i = ...
[["-", 8, 9, 0, 7, 8, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 7, 8, 9, 0, 93, 0, 35]]
1
333
import itertools def abc167c_skill_up(): n, m, x = map(int, input().split()) c = [] a = [] for _ in range(n): v = list(map(int, input().split())) c.append(v[0]) a.append(v[1:]) pattern = itertools.product([0,1], repeat=n) best = float('inf') for p in pattern: ...
import itertools def abc167c_skill_up(): n, m, x = map(int, input().split()) c = [] a = [] for _ in range(n): v = list(map(int, input().split())) c.append(v[0]) a.append(v[1:]) pattern = itertools.product([0,1], repeat=n) best = float('inf') for p in pattern: ...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
209
import numpy as np N, M, X = map(int, input().split()) C = [] A = [] for _ in range(N): inp = list(map(int, input().split())) C.append(inp[0]) A.append(inp[1:]) A = np.array(A) for i in range(M): if np.sum(A, axis=0)[i] < X: print(-1) exit() min_c = 999999999999999 for i in range(2**...
import numpy as np N, M, X = map(int, input().split()) C = [] A = [] for _ in range(N): inp = list(map(int, input().split())) C.append(inp[0]) A.append(inp[1:]) A = np.array(A) for i in range(M): if np.sum(A, axis=0)[i] < X: print(-1) exit() min_c = 999999999999999 for i in range(2**...
[["-", 0, 57, 15, 666, 0, 657, 31, 652, 63, 22], ["-", 15, 666, 0, 657, 31, 652, 3, 4, 0, 24], ["-", 15, 666, 0, 657, 31, 652, 3, 4, 0, 22], ["-", 15, 666, 0, 657, 31, 652, 3, 4, 0, 25], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 31, 22]]
5
226
N, M, X= map(int, input().split()) arr=[list(map(int, input().split())) for _ in range(N)] ans=float('inf') for paint_h in range(2**N): temp_arr=[0]*M for i in range(N): if (paint_h>>i)&1==1: temp_arr=[a+b for (a, b) in zip(temp_arr, arr[i])] if all(i>=X for i in temp_arr[1:]): ans=min(ans, temp_arr[0]) prin...
N, M, X= map(int, input().split()) arr=[list(map(int, input().split())) for _ in range(N)] ans=float('inf') for paint_h in range(2**N): temp_arr=[0]*(M+1) for i in range(N): if (paint_h>>i)&1==1: temp_arr=[a+b for (a, b) in zip(temp_arr, arr[i])] if all(i>=X for i in temp_arr[1:]): ans=min(ans, temp_arr[0]) ...
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25]]
5
154
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> V(N, vector<int>(M)); vector<int> D(N); for (int L = 0; L < N; L++) { cin >> D[L]; for (int R = 0; R < M; R++) { cin >> V[L][R]; } } int P = 200000; bool bre = false; for ...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> V(N, vector<int>(M)); vector<int> D(N); for (int L = 0; L < N; L++) { cin >> D[L]; for (int R = 0; R < M; R++) { cin >> V[L][R]; } } int P = 10000000; bool bre = false; fo...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
285
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vector<int>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; #define all(x) x.begin(), x.end() #define rep(i, j, n) for (long long i = j; i < (long long)(n); i++) #define _GLIBCXX_DEBUG const ll MOD = ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vector<int>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; #define all(x) x.begin(), x.end() #define rep(i, j, n) for (long long i = j; i < (long long)(n); i++) #define _GLIBCXX_DEBUG const ll MOD = ...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 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
371
// // main.cpp // ABC167C #include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; const int INF = 1001001001; int main(int argc, const char *argv[]) { int a[12][12]; int n, m, x; cin >> n >> m >> x; vector<int> cost(n); // 本の値段 rep(i,...
// // main.cpp // ABC167C #include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; const int INF = 1001001001; int main(int argc, const char *argv[]) { int a[12][12]; int n, m, x; cin >> n >> m >> x; vector<int> cost(n); // 本の値段 rep(i,...
[["+", 8, 9, 0, 9, 0, 14, 8, 9, 0, 46], ["-", 8, 9, 0, 9, 0, 14, 8, 9, 0, 46]]
1
263
import sys n,m,x=map(int,input().split()) A=[] for i in range(n): ca=list(map(int,input().split())) A.append(ca) ans=10**7 for i in range(2**n):#n冊をそれぞれ選ぶか選ばないか tmp=[0]*m cost=0 for j in range(n):#ある選び方 if (1<<j)&i: cost+=A[j][0] for k in range(m): tm...
import sys n,m,x=map(int,input().split()) A=[] for i in range(n): ca=list(map(int,input().split())) A.append(ca) ans=10**7 for i in range(2**n):#n冊をそれぞれ選ぶか選ばないか tmp=[0]*m cost=0 for j in range(n):#ある選び方 if (1<<j)&i: cost+=A[j][0] for k in range(m): tm...
[["+", 0, 7, 8, 196, 0, 7, 75, 76, 0, 95], ["+", 0, 7, 8, 196, 0, 7, 75, 76, 0, 102]]
5
173
import numpy as np N,M,X = map(int,input().split()) clist=[] for i in range(N): clist.append(list(map(int,input().split()))) #print(clist) total_all=[] for i in range(2**N): total=np.zeros(M+1) for j in range(N): # iを2進数表記した場合の下から数えてj番目が1ならtrue if ((i >> j) & 1): tota...
import numpy as np N,M,X = map(int,input().split()) clist=[] for i in range(N): clist.append(list(map(int,input().split()))) #print(clist) total_all=[] for i in range(2**N): total=np.zeros(M+1) for j in range(N): # iを2進数表記した場合の下から数えてj番目が1ならtrue if ((i >> j) & 1): tota...
[["+", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["+", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]]
5
192
import itertools n, m, x = list(map(int,input().split())) c = [] for i in range(n): c.append(list(map(int,input().split()))) mn = 0 for bn in itertools.product([0,1], repeat=n): money = 0 skills = [0]*m for j in range(n): if bn[j] == 1: money += c[j][0] for k in range(m):...
import itertools n, m, x = list(map(int,input().split())) c = [] for i in range(n): c.append(list(map(int,input().split()))) mn = -1 for bn in itertools.product([0,1], repeat=n): money = 0 skills = [0]*m for j in range(n): if bn[j] == 1: money += c[j][0] for k in range(m)...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612], ["-", 15, 652, 3, 4, 0, 658, 8, 666, 667, 47], ["+", 15, 652, 3, 4, 0, 658, 8, 666, 667, 20]]
5
168
N,M,X = map(int,input().split()) d=[] ans = [] for i in range(N): l=list(map(int,input().split())) d.append(l) print(d) for i in range(2**N): u=[0]*M price=0 for j in range(N): if ((i>>j) & 1): price+=d[j][0] for k in range(M): u[k]+=d[j...
N,M,X = map(int,input().split()) d=[] ans = [] for i in range(N): l=list(map(int,input().split())) d.append(l) for i in range(2**N): u=[0]*M price=0 for j in range(N): if ((i>>j) & 1): price+=d[j][0] for k in range(M): u[k]+=d[j][k+1] ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
166
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) vector<int> IntegerToVector(int bit, int N) { vector<int> S; for (int i = 0; i < N; ++i) { if (bit & (1 << i)) { S.push_back(i); } } return S; } int main() { int n, m, x; cin >> n >> m >> x; vector<...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) vector<int> IntegerToVector(int bit, int N) { vector<int> S; for (int i = 0; i < N; ++i) { if (bit & (1 << i)) { S.push_back(i); } } return S; } int main() { int n, m, x; cin >> n >> m >> x; vector<...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
353
/// Combination + Bit mask #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf = 1e9; #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
/// Combination + Bit mask #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll inf = 1e9; #define Fast \ ios_base::sync_with_stdio(false); \ cin.tie(0); ...
[["+", 51, 16, 12, 23, 0, 16, 12, 23, 0, 24], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 17, 33], ["+", 12, 23, 0, 16, 12, 23, 0, 16, 12, 13], ["+", 51, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
298
import itertools n, m, x = list(map(int, input().split())) c = [] a = [] for i in range(n): tmp = list(map(int, input().split())) c.append(tmp.pop(0)) a.append(tmp) min_cost = 10 ** 5 + 1 for i in range(1, n + 1): for j in list(itertools.combinations(range(n), i)): recog = [0] * m cost...
import itertools n, m, x = list(map(int, input().split())) c = [] a = [] for i in range(n): tmp = list(map(int, input().split())) c.append(tmp.pop(0)) a.append(tmp) min_cost = 10 ** 5 * 12 + 1 for i in range(1, n + 1): for j in list(itertools.combinations(range(n), i)): recog = [0] * m ...
[["+", 0, 1, 0, 662, 12, 657, 31, 657, 17, 48], ["+", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["+", 0, 57, 15, 666, 0, 657, 31, 657, 17, 48], ["+", 0, 57, 15, 666, 0, 657, 31, 657, 12, 612]]
5
198
import numpy as np N, M, X = list(map(int, input().split())) a = np.zeros((N, M)) C = np.zeros(N) for i in range(N): tmp = list(map(int, input().split())) C[i] += tmp[0] a[i] += tmp[1:] answer_price = 2**10 for i in range(1 << N): tmp = np.zeros(M) cost = 0 for j in range(N): if i...
import numpy as np N, M, X = list(map(int, input().split())) a = np.zeros((N, M)) C = np.zeros(N) for i in range(N): tmp = list(map(int, input().split())) C[i] += tmp[0] a[i] += tmp[1:] answer_price = 10**10 for i in range(1 << N): tmp = np.zeros(M) cost = 0 for j in range(N): if ...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 31, 612], ["+", 8, 196, 0, 57, 15, 679, 12, 23, 0, 24], ["+", 8, 196, 0, 57, 15, 679, 12, 23, 0, 25], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 31, 612], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 31, 612]]
5
184
n,m,x=map(int,input().split()) ans=999999999999999999 a=[0]*m for i in range(n): a[i]=list(map(int,input().split())) for i in range(2**n): t=[0]*m temp=0 for j in range(n): if (i>>j)&1: temp=temp+a[j][0] for k in range(m): t[k]=t[k]+a[j][k+1] if min(t)>=x: ans=min(ans,temp) if ans=...
n,m,x=map(int,input().split()) ans=999999999999999999 a=[0]*n for i in range(n): a[i]=list(map(int,input().split())) for i in range(2**n): t=[0]*m temp=0 for j in range(n): if (i>>j)&1: temp=temp+a[j][0] for k in range(m): t[k]=t[k]+a[j][k+1] if min(t)>=x: ans=min(ans,temp) if ans=...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
163
def cos_per_find(count, cost, skills): if count == N: if min(skills) >= X: return cost else: return INF improved_skills = [a+b for a, b in zip(skills, contents[count])] return min(cos_per_find(count+1, cost, skills), cos_per_find(count+1, cost+price[count], improved_s...
def cos_per_find(count, cost, skills): if count == N: if min(skills) >= X: return cost else: return INF improved_skills = [a+b for a, b in zip(skills, contents[count])] return min(cos_per_find(count+1, cost, skills), cos_per_find(count+1, cost+price[count], improved_s...
[["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 654], ["+", 0, 662, 12, 652, 3, 4, 0, 557, 0, 655]]
5
180
from itertools import combinations import numpy as np #買う本 N, M, X = map(int, input().split()) items = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int32) all_book= [i for i in range(N)] out = 10**18 #for c in itertools.product([False, True], repeat=N): for num in range(1,N+1): #1冊から...
from itertools import combinations import numpy as np #買う本 N, M, X = map(int, input().split()) items = np.array([list(map(int, input().split())) for _ in range(N)], dtype=np.int32) all_book= [i for i in range(N)] out = 10**18 flag =False #for c in itertools.product([False, True], repeat=N): for num i...
[["+", 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, 147]]
5
180
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N, vector<int>(M)); 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 price_min = accumulate(C.beg...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N, vector<int>(M)); 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 price_min = accumulate(C.beg...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
375
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m, x; cin >> n >> m >> x; vector<int> C(n); vector<vector<int>> pa(n, vector<int>(m)); rep(i, n) { cin >> C.at(i); rep(j, m) { cin >> pa.at(...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; int main() { int n, m, x; cin >> n >> m >> x; vector<int> C(12); vector<vector<int>> pa(n, vector<int>(m)); rep(i, n) { cin >> C.at(i); rep(j, m) { cin >> pa.at...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
293
#include <stdio.h> int main(void) { int n, m; long x; scanf("%d %d %ld", &n, &m, &x); long c[n]; long a[n][m]; long long min = 200000; long long sum[1 << n][m]; int flag = 0; for (int i = 0; i < n; i++) { scanf("%ld", &c[i]); for (int j = 0; j < m; j++) { scanf("%ld", &a[i][j]); }...
#include <stdio.h> int main(void) { int n, m; long x; scanf("%d %d %ld", &n, &m, &x); long c[n]; long a[n][m]; long long min = 2000000LL; long long sum[1 << n][m]; int flag = 0; for (int i = 0; i < n; i++) { scanf("%ld", &c[i]); for (int j = 0; j < m; j++) { scanf("%ld", &a[i][j]); ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
362
#include <bits/stdc++.h> #include <iostream> using namespace std; const long long int INF = 1LL << 60; const long long int mod = 1e9 + 7; int main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N + 1); vector<vector<int>> A(N + 1, vector<int>(N + 1, 0)); vector<long long> sum_a(N + 1, 0); for (int i ...
#include <bits/stdc++.h> #include <iostream> using namespace std; const long long int INF = 1LL << 60; const long long int mod = 1e9 + 7; int main() { int N, M, X; cin >> N >> M >> X; vector<int> C(N + 1); vector<vector<int>> A(N + 1, vector<int>(M + 1, 0)); vector<long long> sum_a(M + 1, 0); for (int i ...
[["-", 51, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 51, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
583
N, M , X = list(map(int,input().split())) c = [[]]*N a = [[[]]*M]*N for n in range(N): temp = list(map(int,input().split())) c[n] = temp[0] a[n] = temp[1:N+1] ans = 10**7 for i in range(2 ** N): price = 0 intelligence = [0 for _ in range(M)] for j in range(N): if ((i >> j) & 1): ...
N, M , X = list(map(int,input().split())) c = [[]]*N a = [[[]]*M]*N for n in range(N): temp = list(map(int,input().split())) c[n] = temp[0] a[n] = temp[1:M+1] ans = 10**7 for i in range(2 ** N): price = 0 intelligence = [0 for _ in range(M)] for j in range(N): if ((i >> j) & 1): ...
[["-", 0, 662, 12, 206, 206, 663, 0, 657, 31, 22], ["+", 0, 662, 12, 206, 206, 663, 0, 657, 31, 22]]
5
216
import numpy as np from numpy import array n, m, x = list(map(int, input().split())) a = [] for i in range(n): a.append(list(map(int, input().split()))) a = array(a) c_min = 0 flag = False for i in range(1, n ** 2 + 1): b = np.zeros(m+1) for k in range(n): if ((i >> k) & 1): b += a...
import numpy as np from numpy import array n, m, x = list(map(int, input().split())) a = [] for i in range(n): a.append(list(map(int, input().split()))) a = array(a) c_min = 0 flag = False for i in range(1, 2 ** n ): b = np.zeros(m+1) for k in range(n): if ((i >> k) & 1): b += a[k]...
[["-", 12, 652, 3, 4, 0, 657, 31, 657, 31, 22], ["-", 12, 652, 3, 4, 0, 657, 31, 657, 17, 578], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 22]]
5
182
N,M,X = map(int,input().split()) books = [] for _ in range(N): info = list(map(int,input().split())) books.append(info) res = float('inf') for i in range(1<<N): scores = [0] * M cost = 0 for j in range(N): if (i>>j)&1: for k,p in enumerate(books[j][1:]): scores[k] += p cost += books[...
N,M,X = map(int,input().split()) books = [] for _ in range(N): info = list(map(int,input().split())) books.append(info) res = float('inf') for i in range(1<<N): scores = [0] * M cost = 0 for j in range(N): if (i>>j)&1: for k,p in enumerate(books[j][1:]): scores[k] += p cost += books[...
[["-", 0, 41, 0, 652, 3, 4, 0, 557, 0, 6], ["+", 0, 41, 0, 652, 3, 4, 0, 557, 0, 6]]
5
172
import sys def calcSum(N, BuyingList_bool, Books): Price = 0 for Num in range(N): if(BuyingList_bool[Num]): Price += Books[Num][0] return Price def search(N, M, X, Books, BuyingList_bool, Prices = [], BranchPos =0): if(BranchPos == N): Complehensives = [0] * M for m...
import sys def calcSum(N, BuyingList_bool, Books): Price = 0 for Num in range(N): if(BuyingList_bool[Num]): Price += Books[Num][0] return Price def search(N, M, X, Books, BuyingList_bool, Prices = [], BranchPos =0): if(BranchPos == N): Complehensives = [0] * M for ...
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 102], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 64, 196, 0, 1, 0, 662, 12, 634, 0, 70], ["-", 64, 196, 0, 1, 0, 662, 12, 634, 0, 73]]
5
372
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #define ll long long #define PB push_back #define POP pop_back() #define PII pair<int, int> #define FI first #define SE second #define ULL unsigned long long #define endl '\n' using namespace std; con...
#include <algorithm> #include <bits/stdc++.h> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #define ll long long #define PB push_back #define POP pop_back() #define PII pair<int, int> #define FI first #define SE second #define ULL unsigned long long #define endl '\n' using namespace std; con...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
354
n, m, x = map(int, input().split()) cas = [list(map(int, input().split())) for i in range(n)] # 合否判定のためのフラグ Flag = False cost_min = 0 for i in range(n): cost_min += cas[i][0] # 全ての組み合わせについてチェック for i in range(2**n): bag = [0]*(m+1) # バッグに荷物を詰める for j in range(n): if ((i>>j) & 1): for k in range(m+1...
n, m, x = map(int, input().split()) cas = [list(map(int, input().split())) for i in range(n)] # 合否判定のためのフラグ Flag = False cost_min = 0 for i in range(n): cost_min += cas[i][0] # 全ての組み合わせについてチェック for i in range(2**n): bag = [0]*(m+1) # バッグに荷物を詰める for j in range(n): if ((i>>j) & 1): for k in range(m+1...
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 22]]
5
177
N,M,X=map(int,input().split()) l=[list(map(int,input().split())) for i in range(n)] cmin=12*10**5+1 for bit in range(2**N): A=[0]*M c=0 for j in range(N): if (bit>>j)&1: c+=l[j][0] A=[x+y for (x,y) in zip(A, l[j][1:])] if min(A) >= X: cmin=min(cmin,c) if cmin!=...
N,M,X=map(int,input().split()) l=[list(map(int,input().split())) for i in range(N)] cmin=12*10**5+1 for bit in range(2**N): A=[0]*M c=0 for j in range(N): if (bit>>j)&1: c+=l[j][0] A=[x+y for (x,y) in zip(A, l[j][1:])] if min(A) >= X: cmin=min(cmin,c) if cmin!=...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
164
import numpy as np N, M, X = map(int, input().split()) ca = [] for _ in range(N): ca.append( list(map(int, input().split()))) ca.sort(key=lambda x:-x[0]) ca = np.array(ca) # ans = 10000000 skill = [0]*(M+1) def DFS(n,skill): global ans if skill[0] >= ans: return if min(skill[1:]) >= X: ans = min(ans...
import numpy as np N, M, X = map(int, input().split()) ca = [] for _ in range(N): ca.append( list(map(int, input().split()))) ca.sort(key=lambda x:-x[0]) ca = np.array(ca) # ans = 10000000 skill = [0]*(M+1) def DFS(n,skill): global ans if skill[0] >= ans: return if min(skill[1:]) >= X: ans = min(ans...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
198
def nextg(x, place): if x[place] == 1: x[place] = 0 if place == 0: return x return nextg(x, place-1) if x[place] == 0: x[place] = 1 return x n, m, t = map(int,input().split()) generator = [0]*n books = [] for i in range(0, n): books.append(list(map(int,inp...
def nextg(x, place): if x[place] == 1: x[place] = 0 if place == 0: return x return nextg(x, place-1) if x[place] == 0: x[place] = 1 return x n, m, t = map(int,input().split()) generator = [0]*n books = [] for i in range(0, n): books.append(list(map(int,inp...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 0, 57, 75, 665, 15, 666, 0, 657, 17, 33], ["-", 0, 57, 75, 665, 15, 666, 0, 657, 12, 612]]
5
277
n,m,x = map(int,input().split()) c = [list(map(int,input().split())) for i in range(n)] ans = float('inf') print(c) for i in range(2**n):#行数回す。(10進数) hold = [0] * (m+1) for j in range(n):#行数回す(2進数)。flagを立てる。 if (i >> j) & 1:# i(二進数)をj個右に動かす。 for k in range(m+1): hold[k] +=...
n,m,x = map(int,input().split()) c = [list(map(int,input().split())) for i in range(n)] ans = float('inf') for i in range(2**n):#行数回す。(10進数) hold = [0] * (m+1) for j in range(n):#行数回す(2進数)。flagを立てる。 if (i >> j) & 1:# i(二進数)をj個右に動かす。 for k in range(m+1): hold[k] += c[j][k] ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
164
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<char, ll> pcl; #define m0(x) memset(x, 0, sizeof(x)) #define all(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < (n); i++) #...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<char, ll> pcl; #define m0(x) memset(x, 0, sizeof(x)) #define all(x) x.begin(), x.end() #define rep(i, n) for (int i = 0; i < (n); i++) #...
[["-", 15, 339, 51, 16, 12, 23, 0, 16, 31, 22], ["-", 15, 339, 51, 16, 12, 23, 0, 16, 17, 151], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 17, 151], ["+", 15, 339, 51, 16, 12, 23, 0, 16, 12, 22]]
1
333
n,m,x = map(int, input().split()) book = [] for _ in range(n): book.append(list(map(int, input().split()))) min_cost = 9999999 for i in range(1,2**n): b = format(i, 'b') b = b.zfill(n) cost = 0 us = [0 for _ in range(m)] for j in range(len(b)): if int(b[j]) == 1: cost += book[j][0] for...
n,m,x = map(int, input().split()) book = [] for _ in range(n): book.append(list(map(int, input().split()))) min_cost = 9999999 for i in range(1,2**n): b = format(i, 'b') b = b.zfill(n) cost = 0 us = [0 for _ in range(m)] for j in range(len(b)): if int(b[j]) == 1: cost += book[j][0] for...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
189
N, M, X = gets.chomp.split(" ").map(&:to_i) DATA = [] N.times.map { gets.chomp }.each do |row| values = row.split(" ").map(&:to_i) DATA << {c: values.shift, a: values} end def hoge(arr) price = 0 lern = [] arr.each do |i| price += DATA[i][:c] M.times do |j| lern[j] = 0 unless lern[j] ...
N, M, X = gets.chomp.split(" ").map(&:to_i) DATA = [] N.times.map { gets.chomp }.each do |row| values = row.split(" ").map(&:to_i) DATA << {c: values.shift, a: values} end def hoge(arr) price = 0 lern = [] arr.each do |i| price += DATA[i][:c] M.times do |j| lern[j] = 0 unless lern[j] ...
[["-", 36, 36, 36, 36, 0, 493, 0, 751, 0, 121]]
4
249
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1); String s; String sl[]; s = r.readLine(); sl = s...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1); String s; String sl[]; s = r.readLine(); sl = ...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 12, 499], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 31, 499], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 17, 151], ["+", 8, 196, 0, 7, 15, 16, 12, 16, 12, 499]]
3
413
N,M,X = map(int,input().split()) books = [list(map(int,input().split())) for i in range(N)] bag = [] for i in range(2**N): temp = [] job = [0] * M for s in range(N): if (i>>s)&1: temp.append(s) for j in range(M): job[j] += item[s][j+1] for s in range(len(job)): if job[s]<X: br...
# coding: utf-8 N,M,X = map(int,input().split()) item = [list(map(int,input().split())) for i in range(N)] bag = [] for i in range(2**N): temp = [] job = [0] * M for s in range(N): if (i>>s)&1: temp.append(s) for j in range(M): job[j] += item[s][j+1] for s in range(len(job)): if job...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]]
5
176
#include <bits/stdc++.h> using namespace std; #define deb(x) cout << #x << "=" << x << endl; #define deb2(x, y) cout << #x << "=" << x << ", " << #y << "=" << y << endl; #define deb3(x, y, z) \ cout << #x << "=" << x << ", " << #y << "=" << y << ", " << #z << "...
#include <bits/stdc++.h> using namespace std; #define deb(x) cout << #x << "=" << x << endl; #define deb2(x, y) cout << #x << "=" << x << ", " << #y << "=" << y << endl; #define deb3(x, y, z) \ cout << #x << "=" << x << ", " << #y << "=" << y << ", " << #z << "...
[["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 35]]
1
434
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const int INF = 1001001001; int a[12][12]; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); rep(i, n) { cin >> c[i]; rep(j, m) cin >> a[i][j]; ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const int INF = 1001001001; int a[12][12]; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); rep(i, n) { cin >> c[i]; rep(j, m) cin >> a[i][j]; ...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
240
#include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> using namespace std; int main() { int m, n, x; cin >> n >> m >> x; int c[n + 1], a[n + 1][m + 1]; int result = 10000000; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } }...
#include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> using namespace std; int main() { int m, n, x; cin >> n >> m >> x; int c[n + 1], a[n + 1][m + 1]; int result = 10000000; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } }...
[["-", 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; using ll = long long; #define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, x; cin >> n >> m >> x; int c[n]; int a[n][m]; for (int i = 0; i < n; i++) { cin >> c[i]; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, x; cin >> n >> m >> x; int c[n]; int a[n][m]; for (int i = 0; i < n; i++) { cin >> c[i]; ...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22]]
1
285
#include <algorithm> #include <ctime> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; #define PI 3.14159265358979323846264338327950L int INF = INT32_MAX; // std::numeric_limits<int>::infinity(); int res; int main() { cin.tie(nullptr); ios::sync_w...
#include <algorithm> #include <ctime> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <string> using namespace std; #define PI 3.14159265358979323846264338327950L int INF = INT32_MAX; // std::numeric_limits<int>::infinity(); int res; int main() { cin.tie(nullptr); ios::sync_w...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
490
/* */ #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep2(i, a, n) for (int i = (a); i < (n); i++) #define rep(i, n) rep2(i, 0, n) template <class T, class U> void chmin(T &t, U f) { if (t > f) t = f; } template <class T, class U> void chmax(T &t, U f) { if (t < f) t = f; } i...
/* */ #include <bits/stdc++.h> using namespace std; using ll = long long; #define rep2(i, a, n) for (int i = (a); i < (n); i++) #define rep(i, n) rep2(i, 0, n) template <class T, class U> void chmin(T &t, U f) { if (t > f) t = f; } template <class T, class U> void chmax(T &t, U f) { if (t < f) t = f; } i...
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 12, 13], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 12, 13]]
1
369
package main import ( "bufio" "fmt" "io" "math" "os" "strconv" ) func main() { sc := newScanner(os.Stdin) N, M, X := sc.i(), sc.i(), sc.i() books := make([][]int, 0, N) for i := 0; i < N; i++ { book := sc.is(M + 1) books = append(books, book) } ans := 12345678 all := 1 << N for mask := 0; mask < all...
package main import ( "bufio" "fmt" "io" "math" "os" "strconv" ) func main() { sc := newScanner(os.Stdin) N, M, X := sc.i(), sc.i(), sc.i() books := make([][]int, 0, N) for i := 0; i < N; i++ { book := sc.is(M + 1) books = append(books, book) } ans := 12345678 all := 1 << N for mask := 0; mask < all...
[["+", 12, 432, 0, 16, 12, 437, 71, 16, 17, 72], ["+", 12, 432, 0, 16, 12, 437, 71, 16, 12, 433]]
7
741
#include <algorithm> #include <iostream> #include <vector> using namespace std; vector<int> next_comb(int n, int k, vector<int> v) { if (n < k) cout << "error" << endl; for (int i = 0; i < v.size() - 1; ++i) { if (v[i] >= v[i + 1]) cout << "error" << endl; } for (int i = k - 1; i >= 0; --i) { ...
#include <algorithm> #include <iostream> #include <vector> using namespace std; vector<int> next_comb(int n, int k, vector<int> v) { if (n < k) cout << "error" << endl; for (int i = 0; i < v.size() - 1; ++i) { if (v[i] >= v[i + 1]) cout << "error" << endl; } for (int i = k - 1; i >= 0; --i) { ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 49, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 7, 26, 27, 28, 22], ["+", 0, 7, 8, 9, 0, 7, 26...
1
577
INF=100050 N,M,X=map(int,input().split()) A=[] C=[] for i in range(N): array=list(map(int,input().split())) C.append(array[0]) A.append(array[1:]) combination=[i for i in range(2**N)] min_price=INF for i in range(2**N): price=0 knowledge=[0 for i in range(M)] for j in range(N): if c...
INF=10000050 N,M,X=map(int,input().split()) A=[] C=[] for i in range(N): array=list(map(int,input().split())) C.append(array[0]) A.append(array[1:]) combination=[i for i in range(2**N)] min_price=INF for i in range(2**N): price=0 knowledge=[0 for i in range(M)] for j in range(N): if...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
206
#Cbit全探索 n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for i in range(n)] ans = [0]*(m+1); ans[0] = 10**7 for i in range(2**n): state = [0]*(m+1) for j in range(n): if (i >> j) & 1: for k in range(m+1): state[k] += books[m-1-j][k] for j i...
#Cbit全探索 n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for i in range(n)] ans = [0]*(m+1); ans[0] = 10**7 for i in range(2**n): state = [0]*(m+1) for j in range(n): if (i >> j) & 1: for k in range(m+1): state[k] += books[n-1-j][k] for j i...
[["-", 12, 206, 51, 206, 206, 657, 31, 657, 31, 22], ["+", 12, 206, 51, 206, 206, 657, 31, 657, 31, 22]]
5
190
#define _GLIBCXX_DEBUG #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++) #include <bits/stdc++.h> using namespace std; int main() { int N, M, X; int table[12][12]; int ans = 100001; cin >> N >> M >> X; vector<int> C(N); rep(i, N) { cin >> C...
#define _GLIBCXX_DEBUG #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++) #include <bits/stdc++.h> using namespace std; int main() { int N, M, X; int table[12][12]; int ans = 1001001001; cin >> N >> M >> X; vector<int> C(N); rep(i, N) { cin ...
[["-", 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
277
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; const int C_MAX = 1200001; int solve(int N, int M, int X, vector<int> C, vector<vector<int>> A) { vector<int> scores(M, 0); int min = C_MAX; for (int i = 1; i <= pow(2, N) - 1; i++) { int price = 0; // price...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; const int C_MAX = 1200001; int solve(int N, int M, int X, vector<int> C, vector<vector<int>> A) { vector<int> scores(M, 0); int min = C_MAX; for (int i = 0; i <= pow(2, N) - 1; i++) { int price = 0; // price...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 72], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
381
# bit全探索問題 N,M,X = map(int,input().split()) items = [list(map(int,input().split())) for _ in range(N)] ans = -1 for i in range(1 << N): total = [0]*(M+1) for j in range(N): if ((i >> j) & 1): # 順に右にシフトさせ最下位bitのチェックを行う h = [x + y for (x, y) in zip(total, items[j])] # print(total) ...
# bit全探索問題 N,M,X = map(int,input().split()) items = [list(map(int,input().split())) for _ in range(N)] ans = -1 for i in range(1 << N): total = [0]*(M+1) for j in range(N): if ((i >> j) & 1): # 順に右にシフトさせ最下位bitのチェックを行う total = [x + y for (x, y) in zip(total, items[j])] # print(total) ...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 652, 3, 668, 0, 659, 12, 206, 51, 22], ["+", 0, 652, 3, 668, 0, 659, 12, 206, 51, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 206, 51, 22]]
5
161
import numpy as np n, M, X = list(map(int, input().split())) CA = [] A = [] for _ in range(N): L = list(map(int, input().split())) CA.append(L[:]) ans = np.zeros(M+1) S = [0]*n ANS = list() def makeCombination(): for i in range(0, n-1): S[i] = 0 rec(0, ans) def rec(i,ans): if i == n: ...
import numpy as np n, M, X = list(map(int, input().split())) CA = [] A = [] for _ in range(n): L = list(map(int, input().split())) CA.append(L[:]) ans = np.zeros(M+1) S = [0]*n ANS = list() def makeCombination(): for i in range(0, n-1): S[i] = 0 rec(0, ans) def rec(i,ans): if i == n: ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
226
#include <bits/stdc++.h> #define ll long long int #define CON 100010 //#define MOD 1e9+7 const long long mod = 1e9 + 7; const int INF = 1001001001; using namespace std; int a[12][12]; int main() { int N, M, X; cin >> N >> M >> X; vector<int> algo(M); for (int i = 0; i < N; i++) { cin >> algo[i]; for (in...
#include <bits/stdc++.h> #define ll long long int #define CON 100010 //#define MOD 1e9+7 const long long mod = 1e9 + 7; const int INF = 1001001001; using namespace std; int a[12][12]; int main() { int N, M, X; cin >> N >> M >> X; vector<int> algo(N); for (int i = 0; i < N; i++) { cin >> algo[i]; for (in...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
297
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; typedef pair<int, int> P; const ll mod = 1000000007; int main() { int n, m, x, ans = 10000000; cin >> n >> m >> x; int c[n]; vector<vector<int>> v(n, vector<int>(m, 0)); r(i, n) { cin >> c[i];...
#include <bits/stdc++.h> #define r(i, n) for (int i = 0; i < n; i++) typedef long long ll; using namespace std; typedef pair<int, int> P; const ll mod = 1000000007; int main() { int n, m, x, ans = 10000000; cin >> n >> m >> x; int c[n]; vector<vector<int>> v(n, vector<int>(m, 0)); r(i, n) { cin >> c[i];...
[["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22]]
1
268
#include <algorithm> #include <iostream> #include <vector> std::vector<int> res; int n, m, x; std::vector<std::vector<int>> vec; std::vector<int> book_prices; int main() { std::cin >> n >> m >> x; book_prices.assign(n, 0); vec.assign(n, std::vector<int>(m, 0)); for (int i = 0; i < n; i++) { std::cin >> b...
#include <algorithm> #include <iostream> #include <vector> std::vector<int> res; int n, m, x; std::vector<std::vector<int>> vec; std::vector<int> book_prices; int main() { std::cin >> n >> m >> x; book_prices.assign(n, 0); vec.assign(n, std::vector<int>(m, 0)); for (int i = 0; i < n; i++) { std::cin >> b...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
328
n,m,x = map(int, input().split()) ca = [list(map(int, input().split())) for _ in range(n)] anytassei = False # bit = [0 for _ in range(n)] mincost = 0 cost = 0 learn = [0 for _ in range(n)] for i in range(n): mincost += ca[i][0] for cnt in range(2**n): cost = 0 learn = [0 for _ in range(n)] # bit膳探索 for i in ra...
n,m,x = map(int, input().split()) ca = [list(map(int, input().split())) for _ in range(n)] anytassei = False # bit = [0 for _ in range(n)] mincost = 0 cost = 0 learn = [0 for _ in range(n)] for i in range(n): mincost += ca[i][0] for cnt in range(2**n): cost = 0 learn = [0 for _ in range(m)] # bit膳探索 for i in ra...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
214
#include "bits/stdc++.h" using namespace std; const long long inf = 1e9; #define ll long long #define fr(i, a, n) for (int i = a; i < n; i++) #define rfr(i, n, a) for (int i = n; i >= a; i--) #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define endl "\n" typedef vector...
#include "bits/stdc++.h" using namespace std; const long long inf = 1e9; #define ll long long #define fr(i, a, n) for (int i = a; i < n; i++) #define rfr(i, n, a) for (int i = n; i >= a; i--) #define mp make_pair #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define endl "\n" typedef vector...
[["-", 31, 16, 12, 23, 0, 41, 15, 16, 12, 13], ["+", 31, 16, 12, 23, 0, 41, 15, 16, 12, 13]]
1
395
package main import ( "fmt" "sort" ) func main() { var ( bookNum int studyNum int goalLevel int ) fmt.Scan(&bookNum, &studyNum, &goalLevel) bookPrices := []int{} levels := [][]int{} for i := 0; i < bookNum; i++ { bookPrice := 0 fmt.Scan(&bookPrice) bookPrices = append(bookPrices, bookPrice) ...
package main import ( "fmt" "sort" ) func main() { var ( bookNum int studyNum int goalLevel int ) fmt.Scan(&bookNum, &studyNum, &goalLevel) bookPrices := []int{} levels := [][]int{} for i := 0; i < bookNum; i++ { bookPrice := 0 fmt.Scan(&bookPrice) bookPrices = append(bookPrices, bookPrice) ...
[["-", 8, 196, 0, 7, 0, 430, 15, 16, 12, 22], ["+", 8, 196, 0, 7, 0, 430, 15, 16, 12, 22], ["-", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165], ["+", 36, 36, 0, 434, 0, 435, 8, 196, 0, 165]]
7
364
import sys N, M, X=map(int, sys.stdin.readline().rstrip().split()) A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)] cost=[] for i in range(1<<N): #Bit All Search l=[0]*(M+1) for j in range(N): if((i>>j)&1): l=[l[k]+A[j][k] for k in range(M+1)] for k in range(M): if l[k+1]<X: ...
import sys N, M, X=map(int, sys.stdin.readline().rstrip().split()) A = [list(map(int, sys.stdin.readline().rstrip().split())) for i in range(N)] cost=[] for i in range(1<<N): #Bit All Search l=[0]*(M+1) for j in range(N): if((i>>j)&1)==1: l=[l[k]+A[j][k] for k in range(M+1)] for k in range(M): if l[k+1]<X: ...
[["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
182
n, m, x = gets.chomp.split(" ").map {|c| c.to_i} clist = [] alist = [] n.times do |i| line = gets.chomp.split(" ").map {|c| c.to_i} clist.push line.shift alist.push line end min_cost = clist.sum (2**n).times do |i| ilen = i.bit_length i_total_points = Array.new(m, 0) i_cost = 0 ilen.times do |pos| if...
n, m, x = gets.chomp.split(" ").map {|c| c.to_i} clist = [] alist = [] n.times do |i| line = gets.chomp.split(" ").map {|c| c.to_i} clist.push line.shift alist.push line end min_cost = clist.sum + 1 (2**n).times do |i| ilen = i.bit_length i_total_points = Array.new(m, 0) i_cost = 0 ilen.times do |pos| ...
[["+", 36, 36, 0, 493, 0, 662, 12, 738, 17, 72], ["+", 36, 36, 0, 493, 0, 662, 12, 738, 12, 612], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 17, 72], ["+", 0, 493, 0, 121, 15, 738, 12, 738, 12, 612]]
4
186
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, c) for (int i = 0; i < (int)c; i++) #define all(v) v.begin(), v.end() using ll = long long; using P = pair<int, int>; const int inf = 1000000000; // 10^9 const ll MOD = 1e9 + 7; //加算代入演算子は+=!!!!! // int 2^31 10^9まで int main() { int n,...
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; #define rep(i, c) for (int i = 0; i < (int)c; i++) #define all(v) v.begin(), v.end() using ll = long long; using P = pair<int, int>; const int inf = 1000000000; // 10^9 const ll MOD = 1e9 + 7; //加算代入演算子は+=!!!!! // int 2^31 10^9まで int main() { int n,...
[["+", 8, 9, 0, 9, 0, 14, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
279
// +build ignore package main import ( "bufio" "fmt" "io" "os" "sort" "strconv" ) // I/O type Scanner struct { sc *bufio.Scanner } func NewScanner() *Scanner { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) sc.Buffer(make([]byte, 1024), int(1e+9)) return &Scanner{sc} } func (s *Scanner) nextS...
// +build ignore package main import ( "bufio" "fmt" "io" "os" "sort" "strconv" ) // I/O type Scanner struct { sc *bufio.Scanner } func NewScanner() *Scanner { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) sc.Buffer(make([]byte, 1024), int(1e+9)) return &Scanner{sc} } func (s *Scanner) nextS...
[["-", 0, 465, 8, 196, 0, 57, 15, 16, 17, 20], ["+", 0, 465, 8, 196, 0, 57, 15, 16, 17, 47]]
7
832
import math, sys from bisect import bisect_left, bisect_right from collections import Counter, defaultdict, deque from copy import deepcopy from functools import lru_cache from heapq import heapify, heappop, heappush from itertools import accumulate, combinations, permutations input = sys.stdin.readline mod = 10**9 + 7...
import math, sys from bisect import bisect_left, bisect_right from collections import Counter, defaultdict, deque from copy import deepcopy from functools import lru_cache from heapq import heapify, heappop, heappush from itertools import accumulate, combinations, permutations input = sys.stdin.readline mod = 10**9 + 7...
[["-", 12, 657, 31, 657, 12, 23, 0, 657, 31, 22], ["+", 12, 657, 31, 657, 12, 23, 0, 657, 31, 22]]
5
307
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) typedef long long ll; constexpr auto INFI = 2147483647; const ll INFL = 9223372036854775807; const int MAX = 12; int main() { int n, m, x; int price[12]; int value[12...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = n - 1; i >= 0; i--) typedef long long ll; constexpr auto INFI = 2147483647; const ll INFL = 9223372036854775807; const int MAX = 12; int main() { int n, m, x; int price[12]; int value[12...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
305
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using p = pair<int, int>; int main(int argc, const char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); int n, m, x, min_p = 1e9; cin >> n >> m >> x; int c[n]; int a[n][m]; rep(i, n) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; using ll = long long; using p = pair<int, int>; int main(int argc, const char *argv[]) { cin.tie(0); ios::sync_with_stdio(false); int n, m, x, min_p = 1e9; cin >> n >> m >> x; int c[n]; int a[n][m]; rep(i, n) { ...
[["-", 8, 9, 0, 14, 8, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 14, 8, 9, 0, 93, 0, 35]]
1
272
n, m, x = map(int, input().split()) C = [0] * n A = [[] for i in range(n)] for i in range(n): c = list(map(int, input().split())) C[i], A[i] = c[0], c[1:] INF = 10 ** 9 ans = INF for bit in range(0, 1 << n): cost = 0 flag = True tmp = [0] * m for i in range(n): if bit & 1 << i: ...
n, m, x = map(int, input().split()) C = [0] * n A = [[] for i in range(n)] for i in range(n): c = list(map(int, input().split())) C[i], A[i] = c[0], c[1:] INF = 10 ** 9 ans = INF for bit in range(0, 1 << n): cost = 0 flag = True tmp = [0] * m for i in range(n): if bit & 1 << i: ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
198
import sys,itertools N,M,X=map(int,input().split()) ALL=[] cost=0 for i in range(N): listA=list(map(int,input().split())) ALL+=[listA] cost+=listA[0] for i in range(1,M+1): SUM=0 for k in range(N): SUM+=ALL[k][i] if SUM<X: print(-1) sys.exit() cost2=10**9 for take in range(1,N+1): takeL=li...
import sys,itertools N,M,X=map(int,input().split()) ALL=[] cost=0 for i in range(N): listA=list(map(int,input().split())) ALL+=[listA] cost+=listA[0] for i in range(1,M+1): SUM=0 for k in range(N): SUM+=ALL[k][i] if SUM<X: print(-1) sys.exit() cost2=10**9 for take in range(1,N+1): takeL=li...
[["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 33], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
228
// WA ... #include <iostream> #define endl '\n' using namespace std; const int MAX = 12000000; int n, m, x, cost = MAX + 1; int lvl[13]; int t[12][13]; int check() { for (int i = 1; i < m; ++i) { if (lvl[i] < x) return 0; } return 1; } void learn(int idx) { if (check()) { if (lvl[0] < cost) ...
// WA ... #include <iostream> #define endl '\n' using namespace std; const int MAX = 12000000; int n, m, x, cost = MAX + 1; int lvl[13]; int t[12][13]; int check() { for (int i = 1; i < m + 1; ++i) { if (lvl[i] < x) return 0; } return 1; } void learn(int idx) { if (check()) { if (lvl[0] < cost)...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
313
import math def main(): N,M,X = map(int, input().split()) C = [0 for j in range(N)] A = [[0 for j in range(M)] for i in range(N)] for i in range(0, N): l = list(map(int, input().split())) C[i] = l[0] A[i] = l[1:] res = max(C)*N possible = False for i in rang...
import math def main(): N,M,X = map(int, input().split()) C = [0 for j in range(N)] A = [[0 for j in range(M)] for i in range(N)] for i in range(0, N): l = list(map(int, input().split())) C[i] = l[0] A[i] = l[1:] res = max(C)*N possible = False for i in rang...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 19], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["+"...
5
236
n,m,x = map(int, input().split()) ca = [] for i in range(m): ca.append(list(map(int, input().split()))) c = [] a = [] for i in range(len(ca)): c.append(ca[i][0]) a.append(ca[i]) del a[i][0] ans = 12345678 for i in range(2 ** n): cost = 0 level = [0] * m for j in range(n): if(i>>j&1...
n,m,x = map(int, input().split()) ca = [] for i in range(n): ca.append(list(map(int, input().split()))) c = [] a = [] for i in range(len(ca)): c.append(ca[i][0]) a.append(ca[i]) del a[i][0] ans = 12345678 for i in range(2 ** n): cost = 0 level = [0] * m for j in range(n): if((i>>j)...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 23, 0, 24], ["+", 0, 57, 15, 23, 0, 657, 31, 23, 0, 25]]
5
219