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 <iostream> #include <vector> using namespace std; typedef long long li; #define chmin(a, b) (a > (b) ? a = (b), 1 : 0) #define MAX 150000 #define rep(i, n) for (li i = 0; i < (n); i++) #define df 0 template <class T> void print(const T &t) { cout << t << "\n"; } template <class T, class... Ts> void print(const...
#include <iostream> #include <vector> using namespace std; typedef long long li; #define chmin(a, b) (a > (b) ? a = (b), 1 : 0) #define MAX 150000000 #define rep(i, n) for (li i = 0; i < (n); i++) #define df 0 template <class T> void print(const T &t) { cout << t << "\n"; } template <class T, class... Ts> void print(co...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
525
n, m, x = map(int, input().split()) numlist = [] minimum = -1 for i in range(n): numlist.append(list(map(int, input().split()))) for i in range(1<<n): result = [0] * (m+1) for j in range(n): if(i>>j & 1 == 1): for k in range(m+1): result[k] += numlist[j][k] for k in r...
n, m, x = map(int, input().split()) numlist = [] minimum = -1 for i in range(n): numlist.append(list(map(int, input().split()))) for i in range(1<<n): result = [0] * (m+1) for j in range(n): if(i>>j & 1 == 1): for k in range(m+1): result[k] += numlist[j][k] for k in r...
[["-", 0, 57, 15, 23, 0, 679, 31, 666, 0, 22], ["+", 0, 57, 15, 23, 0, 679, 31, 666, 0, 22]]
5
164
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, ans = 12345678; cin >> n >> m >> x; vector<vector<int>> A(n, vector<int>(m)); vector<int> c(n); for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> A[i][j]; } } for (int mask = 0; mask < (...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, ans = 12345678; cin >> n >> m >> x; vector<vector<int>> A(n, vector<int>(m)); vector<int> c(n); for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> A[i][j]; } } for (int mask = 0; mask < (...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
269
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]; for (int i = 0; i < n; i++) { c[i] = sc.nextInt(); f...
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]; for (int i = 0; i < n; i++) { c[i] = sc.nextInt(); f...
[["-", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 15, 16, 12, 22]]
3
395
N,M,X=map(int,input().split()) A=[0]*N for j in range(N): A[j]=[int(x) for x in input().split()] money=10**7 for i in range(2**N): read=[0]*N #その本を読むか否か for h in range(N): if i%2==1: read[h]=1 i//=2 understanding=[0]*M kouho=0 for k in range(N): if read[k]==1...
N,M,X=map(int,input().split()) A=[0]*N for j in range(N): A[j]=[int(x) for x in input().split()] money=10**7 for i in range(2**N): read=[0]*N #その本を読むか否か for h in range(N): if i%2==1: read[h]=1 i//=2 understanding=[0]*M kouho=0 for k in range(N): if read[k]==1...
[["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
198
import itertools def main(): n, m, x = map(int, input().split()) lst = [] for _ in range(n): lst.append(list(map(int, input().split()))) flag1 = True max_lst = [] for i in range(m): understanding = 0 for j in range(n): understanding += lst[j][i+1] m...
import itertools def main(): n, m, x = map(int, input().split()) lst = [] for _ in range(n): lst.append(list(map(int, input().split()))) flag1 = True max_lst = [] for i in range(m): understanding = 0 for j in range(n): understanding += lst[j][i+1] m...
[["-", 0, 57, 64, 196, 0, 52, 15, 666, 0, 22], ["+", 0, 57, 64, 196, 0, 52, 15, 666, 0, 22]]
5
325
n, m, x = map(int, input().split()) bk = [list(map(int, input().split())) for _ in range(n)] pr = 10 ** 7 for i in range(2 ** n): ef = [0] * (m + 1) for j in range(n): if i >> j & 1: ef = [p + q for (p, q) in zip(ef, bk[j])] for k in range(1, m + 1): if ef[k] < x: bre...
n, m, x = map(int, input().split()) bk = [list(map(int, input().split())) for _ in range(n)] pr = 10 ** 7 for i in range(2 ** n): ef = [0] * (m + 1) for j in range(n): if i >> j & 1: ef = [p + q for (p, q) in zip(ef, bk[j])] for k in range(1, m + 1): if ef[k] < x: bre...
[["-", 3, 4, 0, 41, 0, 666, 0, 657, 12, 612], ["+", 3, 4, 0, 41, 0, 666, 0, 657, 12, 612]]
5
158
import java.lang.Math; import java.util.*; public 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(); long books[][] = new long[m][n + 1]; long uv[] = new long[m]; int np = (int)Math....
import java.lang.Math; import java.util.*; public 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(); long books[][] = new long[n][m + 1]; long uv[] = new long[m]; int np = (int)Math....
[["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22], ["-", 49, 200, 51, 227, 497, 505, 0, 16, 31, 22], ["+", 49, 200, 51, 227, 497, 505, 0, 16, 31, 22]]
3
402
"use strict"; const main = (input) => { const spi = input.split('\n'); const [n, m, x] = spi[0].split(' ').map(e => Number(e)); const cArray = new Array(n), aArray = new Array(n); for (let i = 1; i < n + 1; i++) { const work = spi[i].split(' ').map(e => BigInt(e)); cArray[i - 1] = work[0]; const w...
"use strict"; const main = (input) => { const spi = input.split('\n'); const [n, m, x] = spi[0].split(' ').map(e => Number(e)); const cArray = new Array(n), aArray = new Array(n); for (let i = 1; i < n + 1; i++) { const work = spi[i].split(' ').map(e => BigInt(e)); cArray[i - 1] = work[0]; const w...
[["-", 0, 7, 15, 1, 0, 16, 12, 16, 31, 22], ["+", 0, 7, 15, 1, 0, 16, 12, 16, 31, 22], ["-", 8, 556, 0, 7, 8, 556, 0, 1, 0, 35]]
2
405
from itertools import product import numpy as np n, _, x = map(int, input().split()) arr1 = np.array([list(map(int, input().split())) for _ in range(n)]) ans = 120000 if np.all(arr1.sum(0)[1:] >= x): for i in product((0, 1), repeat=n): arr2 = ((i * arr1.T).T).sum(0) if np.all(arr2[1:] >= x): ...
from itertools import product import numpy as np n, _, x = map(int, input().split()) arr1 = np.array([list(map(int, input().split())) for _ in range(n)]) ans = 1200000 if np.all(arr1.sum(0)[1:] >= x): for i in product((0, 1), repeat=n): arr2 = (i * arr1.T).sum(1) if np.all(arr2[1:] >= x): ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 662, 12, 652, 63, 319, 500, 23, 0, 24], ["-", 0, 319, 500, 23, 0, 657, 12, 319, 0, 131], ["-", 0, 319, 500, 23, 0, 657, 12, 319, 319, 22], ["-", 63, 319, 500, 23, 0, 319, 500, 23, 0, 25], ["-", 0, 1, 0, 662, 12, 652, 3...
5
149
from itertools import combinations N, M, X = map(int, input().split()) A = [list(map(int, input().split())) for i in range(N)] flug = True for j in range(1, M + 1): sum_test = 0 for i in range(N): sum_test += A[i][j] if sum_test < X: flug = False break N_idx = [n for n in range(N)] r...
from itertools import combinations N, M, X = map(int, input().split()) A = [list(map(int, input().split())) for i in range(N)] flug = True for j in range(1, M + 1): sum_test = 0 for i in range(N): sum_test += A[i][j] if sum_test < X: flug = False break N_idx = [n for n in range(N)] r...
[["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 22], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 667, 79], ["-", 8, 196, 0, 57, 15, 679, 31, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 31, 666, 667, 20]]
5
219
n,m,x=map(int,input().split()) a=[list(map(int,input().split())) for _ in range(n)] ans=[] for i in range(2**n): bag=[0 for _ in range(m)] total=0 res=True for j in range(n): if ((i>>j)&1): total+=a[j][0] for k in range(m): bag[k]+=a[j][k-1] for l in r...
n,m,x=map(int,input().split()) a=[list(map(int,input().split())) for _ in range(n)] ans=[] for i in range(2**n): bag=[0 for _ in range(m)] total=0 res=True for j in range(n): if ((i>>j)&1): total+=a[j][0] for k in range(m): bag[k]+=a[j][k+1] for l in r...
[["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72]]
5
175
#include <bits/stdc++.h> using namespace std; #define ll long long #define VI vector<int> #define VL vector<ll> #define PII pair<int, int> #define VII vector<PII> #define mp make_pair #define pb push_back #define vt vector #define PI acos(-1) #define ld long double #define endl "\n" #define all(c) (c).begin(), (c).end...
#include <bits/stdc++.h> using namespace std; #define ll long long #define VI vector<int> #define VL vector<ll> #define PII pair<int, int> #define VII vector<PII> #define mp make_pair #define pb push_back #define vt vector #define PI acos(-1) #define ld long double #define endl "\n" #define all(c) (c).begin(), (c).end...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
329
import java.util.*; public class Main { void solve() { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int x = scan.nextInt(); int[] c = new int[n]; int[][] a = new int[n][m]; for (int i = 0; i < n; i++) { c[i] = scan.nextInt(); for (int ...
import java.util.*; public class Main { void solve() { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int x = scan.nextInt(); int[] c = new int[n]; int[][] a = new int[n][m]; for (int i = 0; i < n; i++) { c[i] = scan.nextInt(); for (int ...
[["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22]]
3
374
n,m,x = map(int,input().split()) a = [0]*n for i in range(n): a[i] = list(map(int,input().split())) ans = float("Inf") for i in range(2**n): c = 0 L = [0]*m for j in range(n): if (i>>j)&1: c += a[j][0] for k in range(m): L[k] += a[j][k] sw = 1 ...
n,m,x = map(int,input().split()) a = [0]*n for i in range(n): a[i] = list(map(int,input().split())) ans = float("Inf") for i in range(2**n): c = 0 L = [0]*m for j in range(n): if (i>>j)&1: c += a[j][0] for k in range(m): L[k] += a[j][k+1] sw = 1 ...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
184
n,m,x = map(int,input().split()) ca = [0]*n for i in range(n): ca[i] = list(map(int,input().split())) ans = 10**10 for i in range(n**2): s = [0]*m c = 0 for j in range(n): if (i>>j)&1: c += ca[j][0] for k in range(1,m+1): s[k-1] += ca[j][k] s = sorted(...
n,m,x = map(int,input().split()) ca = [0]*n for i in range(n): ca[i] = list(map(int,input().split())) ans = 10**10 for i in range(2**n): s = [0]*m c = 0 for j in range(n): if (i>>j)&1: c += ca[j][0] for k in range(1,m+1): s[k-1] += ca[j][k] s = sorted(...
[["-", 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
170
def main(): n,m,x = map(int,input().split()) c = [] a = [] for _ in range(n): ca = [int(v) for v in input().split()] c.append(ca[0]) a.append(ca[1:]) INTHIGH = 1<<15 pricemin = INTHIGH for i in range(1<<n): sm = [0]*m sc = 0 for j in range...
def main(): n,m,x = map(int,input().split()) c = [] a = [] for _ in range(n): ca = [int(v) for v in input().split()] c.append(ca[0]) a.append(ca[1:]) INTHIGH = 1<<32 pricemin = INTHIGH for i in range(1<<n): sm = [0]*m sc = 0 for j in range...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 612]]
5
176
#!/usr/bin/env python3 def main(): import sys input = sys.stdin.readline N, M, X = map(int, input().split()) A = [] for i in range(N): a = [int(x) for x in input().split()] A.append(a) ans = 10 ** 7 for bit in range(1 << N): res = [0 for _ in [0] * M] for i...
#!/usr/bin/env python3 def main(): import sys input = sys.stdin.readline N, M, X = map(int, input().split()) A = [] for i in range(N): a = [int(x) for x in input().split()] A.append(a) ans = 10 ** 7 for bit in range(1 << N): res = [0 for _ in [0] * (M + 1)] ...
[["+", 12, 658, 0, 659, 12, 657, 12, 23, 0, 24], ["+", 0, 659, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 659, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 12, 658, 0, 659, 12, 657, 12, 23, 0, 25]]
5
190
N,M,X = map(int,input().split()) C = [] A = [] for i in range(N): L = list(map(int,input().split())) C.append(L[0]) A.append(L[1:M+1]) import itertools L = [] Num = [i for i in range(N)] for i in range(1,N+1): for j in itertools.combinations(Num,i): L.append(list(j)) c = 20000000 for i in range(...
N,M,X = map(int,input().split()) C = [] A = [] for i in range(N): L = list(map(int,input().split())) C.append(L[0]) A.append(L[1:M+1]) import itertools L = [] Num = [i for i in range(N)] for i in range(1,N+1): for j in itertools.combinations(Num,i): L.append(list(j)) c = 20000000 for i in range(...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
253
#include <bits/stdc++.h> #include <iostream> typedef long long ll; #define rep(i, a, b) for (ll i = a; i <= b; i++) #define per(i, a, b) for (ll i = a; i >= b; i--) using namespace std; typedef vector<int> vi; typedef vector<vector<int>> vvi; vi C, X; vvi A; int n, m, x; int findMinCost(int index) { // cout<<index<...
#include <bits/stdc++.h> #include <iostream> typedef long long ll; #define rep(i, a, b) for (ll i = a; i <= b; i++) #define per(i, a, b) for (ll i = a; i >= b; i--) using namespace std; typedef vector<int> vi; typedef vector<vector<int>> vvi; vi C, X; vvi A; int n, m, x; int findMinCost(int index) { // cout<<index<...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22]]
1
333
N,M,X=map(int,input().split()) CA=[list(map(int,input().split())) for _ in range(N)] print(CA) max_=10**16 ans=max_ for bit in range(2**N): check=[0]*M ans_=0 for i in range(N): if bit>>i&1: ans_+=CA[i][0] for j in range(M): check[j]+=CA[i][j+1] if all([k>=X for k in check]): ans=min...
N,M,X=map(int,input().split()) CA=[list(map(int,input().split())) for _ in range(N)] max_=10**16 ans=max_ for bit in range(2**N): check=[0]*M ans_=0 for i in range(N): if bit>>i&1: ans_+=CA[i][0] for j in range(M): check[j]+=CA[i][j+1] if all([k>=X for k in check]): ans=min(ans,ans_)...
[["-", 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
155
#include <bits/stdc++.h> #define SIS std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); #define lowbit(x) (x & -x) #define PI 3.14159265358979323846264338327950L typedef long long ll; using namespace std; const int MAX = 0x7ffffff; const int N = 100; int t; ll a[N][N], c[N], sum[N]; void slove() { int n, m, ...
#include <bits/stdc++.h> #define SIS std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); #define lowbit(x) (x & -x) #define PI 3.14159265358979323846264338327950L typedef long long ll; using namespace std; const int MAX = 0x7ffffff; const int N = 100; int t; ll a[N][N], c[N], sum[N]; void slove() { int n, m, ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 7, 8, 9, 0, 57, 15, 339, 0, 24], ["+", 8, 9, 0, 57, 15, 339, 51, 23, 0, 25]]
1
314
n,m,x = list(map(int,input().split())) cList = [] for i in range(n): cList.append(list(map(int,input().split()))) #buyList = [0 for i in range(n)] priceList = [] for i in range(1,2**n): price = 0 check = 1 skilList = [0 for i in range(m)] bit = i for j in range(1,n+1): if bit % 2 ==...
n,m,x = list(map(int,input().split())) cList = [] for i in range(n): cList.append(list(map(int,input().split()))) priceList = [] for i in range(1,2**n): price = 0 check = 1 skilList = [0 for i in range(m)] bit = i for j in range(1,n+1): if bit % 2 == 1: price += cList[j-1...
[["+", 0, 662, 12, 657, 12, 206, 206, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 206, 206, 657, 12, 612]]
5
201
n, m, x = map(int, input().split()) A = [list(map(int, input().split())) for j in range(n)] ans = 10 ** 7 for i in range(1 << n): s = [0] * (m + 1) for j in range(n): if i >> j & 1: for k in range(m+1): s[k] += A[j][k] if min(s[1:]) >= x: ans = min(ans, s[0]) pri...
n, m, x = map(int, input().split()) A = [list(map(int, input().split())) for j in range(n)] ans = 10 ** 7 for i in range(1 << n): s = [0] * (m + 1) for j in range(n): if i >> j & 1: for k in range(m+1): s[k] += A[j][k] if min(s[1:]) >= x: ans = min(ans, s[0]) pri...
[["-", 0, 1, 0, 41, 0, 666, 0, 657, 12, 612], ["+", 0, 1, 0, 41, 0, 666, 0, 657, 12, 612]]
5
146
#include <bits/stdc++.h> #define REP(i, x, n) for (int i = x; i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x.size()) #define popcount(x) __builtin_popcount(x) #define popcountll(x) __builtin_popcountll(x) #define un...
#include <bits/stdc++.h> #define REP(i, x, n) for (int i = x; i < (int)(n); i++) #define rep(i, n) REP(i, 0, n) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x.size()) #define popcount(x) __builtin_popcount(x) #define popcountll(x) __builtin_popcountll(x) #define un...
[["-", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 0, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
294
#include <algorithm> #include <assert.h> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> ...
#include <algorithm> #include <assert.h> #include <bitset> #include <cassert> #include <cctype> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdint> #include <cstdio> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> ...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
513
import math n, m, x = map(int, input().split()) books = [] for i in range(n): books.append(list(map(int, input().split()))) n_bin = '1'*n _n = (int(n_bin, 2)) ans = 10**9 for i in range(_n): target = bin(i).replace('0b', '').zfill(n) tmp_skill = [0 for i in range(len(books[0])-1)] tmp_price = 0 for...
import math n, m, x = map(int, input().split()) books = [] for i in range(n): books.append(list(map(int, input().split()))) n_bin = '1'*n _n = (int(n_bin, 2))+1 ans = 10**9 for i in range(_n): target = bin(i).replace('0b', '').zfill(n) tmp_skill = [0 for i in range(len(books[0])-1)] tmp_price = 0 ...
[["+", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
229
#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 ans = 100000; int all = 1 <...
#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 ans = 1234567890; int all =...
[["-", 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
293
from itertools import product N, M, X = map(int, input().split()) inp = [list(map(int, input().split())) for _ in range(N)] C, A = [], [] for i in range(N): C.append(inp[i][0]) A.append(inp[i][1:]) #判定 z_A = list(zip(*A)) for i in range(N): if sum(z_A[i]) < X: print(-1) exit() ans = sum(...
from itertools import product N, M, X = map(int, input().split()) inp = [list(map(int, input().split())) for _ in range(N)] C, A = [], [] for i in range(N): C.append(inp[i][0]) A.append(inp[i][1:]) #判定 z_A = list(zip(*A)) for i in range(M): if sum(z_A[i]) < X: print(-1) exit() ans = sum(...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
234
n, m, x = map(int, input().split()) c = [0] * n a = [0] * n for i in range(n): xs = list(map(int, input().split())) c[i] = xs[0] a[i] = xs[1:] ans = 10 ** 9 for i in range(2 ** n): csum = 0 asum = [0] * n for j in range(n): if (i >> j) & 1: csum += c[j] for k in r...
n, m, x = map(int, input().split()) c = [0] * n a = [0] * n for i in range(n): xs = list(map(int, input().split())) c[i] = xs[0] a[i] = xs[1:] ans = 10 ** 9 for i in range(2 ** n): csum = 0 asum = [0] * m for j in range(n): if (i >> j) & 1: csum += c[j] for k in r...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
186
n, m, x = map(int, input().split()) a = [[0] * m for j in range(n)] c = [0] * n ans = 10**10 for i in range(n): arr = list(map(int, input().split())) c[i] = arr[0] a[i] = arr[1:] # bit全探索 import itertools for bit in itertools.product([0,1], repeat=10): arr = [0] * m cost = 0 for i in range(n...
n, m, x = map(int, input().split()) a = [[0] * m for j in range(n)] c = [0] * n ans = 10**10 for i in range(n): arr = list(map(int, input().split())) c[i] = arr[0] a[i] = arr[1:] # bit全探索 import itertools for bit in itertools.product([0,1], repeat=n): arr = [0] * m cost = 0 for i in range(n)...
[["-", 0, 7, 12, 652, 3, 4, 0, 653, 51, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 653, 51, 22]]
5
226
#include <bits/stdc++.h> using namespace std; int a[50][50], c[50], sum[50], ans = INT_MAX, cost; int n, m, x; void dfs(int cur) { if (cur == n + 1) { bool f = 0; for (int i = 1; i <= m; ++i) { if (sum[i] < x) f = 1; } if (f) return; ans = min(ans, cost); return; } dfs(...
#include <bits/stdc++.h> using namespace std; int a[50][50], c[50], sum[50], ans = INT_MAX, cost; int n, m, x; void dfs(int cur) { if (cur == n + 1) { bool f = 0; for (int i = 1; i <= m; ++i) { if (sum[i] < x) f = 1; } if (f) return; ans = min(ans, cost); return; } dfs(...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
279
#include <bits/stdc++.h> using namespace std; int a[50][50], c[50], sum[50], ans = INT_MAX; bool f = 0; int main() { int n, m, x; cin >> n >> m >> x; for (int i = 1; i <= n; i++) { cin >> c[i]; for (int j = 1; j <= m; j++) cin >> a[i][j]; } for (int i = 0; i < (1 << n); ++i) { memset(sum, 0,...
#include <bits/stdc++.h> using namespace std; int a[50][50], c[50], sum[50], ans = INT_MAX; bool f = 0; int main() { int n, m, x; cin >> n >> m >> x; for (int i = 1; i <= n; i++) { cin >> c[i]; for (int j = 1; j <= m; j++) cin >> a[i][j]; } for (int i = 0; i < (1 << n); ++i) { memset(sum, 0,...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
279
#include <bits/stdc++.h> using namespace std; int a[50][50], sum[50], c[50], ans = 1 << 30, cost = 0; int n, m, x; void dfs(int cur) { if (cur == n + 1) { bool bad = 0; for (int i = 1; i <= m; i++) { if (sum[i] < x) { bad = 1; } } if (bad) { return; } ans = min(ans, c...
#include <bits/stdc++.h> using namespace std; int a[50][50], sum[50], c[50], ans = 1 << 30, cost = 0; int n, m, x; void dfs(int cur) { if (cur == n + 1) { bool bad = 0; for (int i = 1; i <= m; i++) { if (sum[i] < x) { bad = 1; } } if (bad) { return; } ans = min(ans, c...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
293
import itertools import numpy as np n,m,x = map(int, input().split()) A = np.array([[int(x) for x in input().split()] for i in range(n)]) lis, min_ = range(n), 13000000 full = [] for r in range(n): comb = list(itertools.combinations(lis,r)) full.extend(comb) for i in full: sum_ = np.zeros(m+1) for k in i:...
import itertools import numpy as np n,m,x = map(int, input().split()) A = np.array([[int(x) for x in input().split()] for i in range(n)]) lis, min_ = range(n), 1200001 full = [] #組み合わせの列挙 for r in range(1,n+1): comb = list(itertools.combinations(lis,r)) full.extend(comb) #print(full) for i in full: #配列の準備 su...
[["-", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 432, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+"...
5
171
M,N,X=map(int,input().split()) C=[list(map(int,input().split())) for i in range(N)] INF=float("inf") ans=INF for i in range(1,2**N): skills=[0]*M total_cost=0 for j in range(N): if ((i>>j)&1): total_cost+=C[j][0] for k in range(M): skills[k]+=C[j][k+1] if...
N,M,X=map(int,input().split()) C=[list(map(int,input().split())) for i in range(N)] INF=float("inf") ans=INF for i in range(1,2**N): skills=[0]*M total_cost=0 for j in range(N): if ((i>>j)&1): total_cost+=C[j][0] for k in range(M): skills[k]+=C[j][k+1] if...
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22]]
5
154
N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] ans = float('inf') for i in range(pow(2, N)-1): cost = 0 x_array = [0]*M for j in range(N): if (i>>j & 1) == 1: cost += CA[j][0] for m in range(M): x_array[m] += CA[j...
N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] ans = float('inf') for i in range(pow(2, N)): cost = 0 x_array = [0]*M for j in range(N): if (i>>j & 1) == 1: cost += CA[j][0] for m in range(M): x_array[m] += CA[j][...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
182
import itertools n, m, x = map(int, input().split()) books = [] for _ in range(n): c = list(map(int, input().split())) books.append(c) patern = [] for i in range(1, n+1): patern += itertools.combinations(range(n), i) cost = 10**6 for j in patern: total = 0 flag = 1 for k in range(1,m+1):...
import itertools n, m, x = map(int, input().split()) books = [] for _ in range(n): c = list(map(int, input().split())) books.append(c) patern = [] for i in range(1, n+1): patern += itertools.combinations(range(n), i) cost = 10**7 for j in patern: total = 0 flag = 1 for k in range(1,m+1):...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
185
#!/usr/bin/env python3 import bisect import heapq import itertools import math import numpy as np 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 i...
#!/usr/bin/env python3 import bisect import heapq import itertools import math import numpy as np 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 i...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
337
#include <math.h> #include <stdio.h> int main(void) { int N, M, X; int C[12]; int A[12][12]; int min = 100000; int ans = -1; 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 i = 1; i <...
#include <math.h> #include <stdio.h> int main(void) { int N, M, X; int C[12]; int A[12][12]; int min = 1000000000; int ans = -1; 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 i = 1;...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
0
311
#import time def main(): N, M, X = map(int, input().split()) Cs = [list(map(int, input().split())) for _ in range(N)] mi = 100000000000000000000 #->float("inf") for i in range(1<<N): lis = [0] * (M+1) for j in range(N): if i & (1<<j) == 0: continue ...
#import time def main(): N, M, X = map(int, input().split()) Cs = [list(map(int, input().split())) for _ in range(N)] mi = 100000000000000000000 #->float("inf") for i in range(1<<N): lis = [0] * (M+1) for j in range(N): if i & (1<<j) == 0: continue ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
167
#include <algorithm> #include <stdio.h> using namespace std; typedef long long llong; #define MAX 13 const llong mod = 1000000000 + 7; const int sumOver = 1e5 * 13; int main() { int N, M, X; int A[MAX][MAX], C[MAX], Y[MAX]; scanf("%d%d%d", &N, &M, &X); for (int i = 0; i < N; i++) { scanf("%d", &C[i]); ...
#include <algorithm> #include <stdio.h> using namespace std; typedef long long llong; #define MAX 13 const llong mod = 1000000000 + 7; const int sumOver = 1e5 * 13; int main() { int N, M, X; int A[MAX][MAX], C[MAX], Y[MAX]; scanf("%d%d%d", &N, &M, &X); for (int i = 0; i < N; i++) { scanf("%d", &C[i]); ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
1
365
n, m, x = map(int, input().split()) c = [] ans = pow(10, 9) for i in range(n): c.append(list(map(int, input().split()))) for mask in range((1 << n) - 1): sum = 0 li = [0] * m for i in range(n): if (mask >> i) & 1 == 0: sum += c[i][0] for j in range(m): l...
n, m, x = map(int, input().split()) c = [] ans = pow(10, 9) for i in range(n): c.append(list(map(int, input().split()))) for mask in range((1 << n) - 1): sum = 0 li = [0] * m for i in range(n): if (mask >> i) & 1 == 0: sum += c[i][0] for j in range(m): l...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612], ["+", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
184
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード //ループ #define rep(i, n) for (int i = 0; i < (n); i++) //普通のループ #define repr(i, n) for (int i = n; i >= 0; i--) //逆ループ //型名省略 typedef long long ll; //値 static const ll MX = 100005; static const ll MX_ll = 1e18; const double PI = acos(-1); //π using namespace std; //ソート #d...
#include <bits/stdc++.h> //全てのヘッダファイルをインクルード //ループ #define rep(i, n) for (int i = 0; i < (n); i++) //普通のループ #define repr(i, n) for (int i = n; i >= 0; i--) //逆ループ //型名省略 typedef long long ll; //値 static const ll MX = 100005; static const ll MX_ll = 1e18; const double PI = acos(-1); //π using namespace std; //ソート #d...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 9, 0, 14, 8, 9, 0, 46], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
301
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using namespace std; int main(void) { int N, M, X; cin >> N >> M >> X; int C[M]; int A[N][M]; rep(i, N) { cin >> C[i]; rep(j, M) cin >> A[i][j]; } int cost_min = 0; rep(i, N) cost_min += C[i]; int...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; using namespace std; int main(void) { int N, M, X; cin >> N >> M >> X; int C[N]; int A[N][M]; rep(i, N) { cin >> C[i]; rep(j, M) cin >> A[i][j]; } ll cost_min = 0; rep(i, N) cost_min += C[i]; int ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78]]
1
287
n, m, x = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] min = float('inf') for i in range(1<<n): # 1<<n == 2**n study = [0 for _ in range(m)] cost = 0 for j in range(n): if i&(1<<j): cost += a[j][0] study = [study[k]+a[j][k] for k in ran...
n, m, x = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] min = float('inf') for i in range(1<<n): # 1<<n == 2**n study = [0 for _ in range(m)] cost = 0 for j in range(n): if i&(1<<j): cost += a[j][0] study = [study[k]+a[j][k+1] for k in r...
[["+", 12, 658, 8, 657, 12, 206, 206, 657, 17, 72], ["+", 12, 658, 8, 657, 12, 206, 206, 657, 12, 612]]
5
172
n,m,x=map(int,input().split()) a=[list(map(int,input().split())) for i in range(n)] # print(a) ans=10**18 for i in range(1<<n): t_money=0 t_rikai=[0]*m ok=True for j in range(n): if i&(1<<j): t_money+=a[j][0] for k in range(m): t_rikai[k]+=a[j][k] for y,r in enumerate(t_rikai): if...
n,m,x=map(int,input().split()) a=[list(map(int,input().split())) for i in range(n)] # print(a) ans=10**18 for i in range(1<<n): t_money=0 t_rikai=[0]*m ok=True for j in range(n): if i&(1<<j): t_money+=a[j][0] for k in range(m): t_rikai[k]+=a[j][k+1] for y,r in enumerate(t_rikai): ...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
170
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<string> vs; #define forl(i, a, b) for (int i = a; i < b; i++) #define rfor(i, b, a) for (int i = b; i >= a; i--) #define f first #define s second #defi...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef pair<int, int> pi; typedef vector<string> vs; #define forl(i, a, b) for (int i = a; i < b; i++) #define rfor(i, b, a) for (int i = b; i >= a; i--) #define f first #define s second #defi...
[["+", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 24], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 25], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
408
n,m,x = map(int,input().split()) c = [0]*n a = [[]]*n for i in range(n) : d = list(map(int,input().split())) c[i] = d[0] a[i] = d[1:m+1] max = 2**n ans = 10**18 for i in range(max) : num = i cost = 0 r = [0]*m check = 0 for j in range(n) : f = num%2 num = num//2 ...
import itertools n,m,x = map(int,input().split()) c = [0]*n a = [[]]*n for i in range(n) : d = list(map(int,input().split())) c[i] = d[0] a[i] = d[1:m+1] max = 2**n ans = 10**18 for i in range(max) : num = i cost = 0 r = [0]*m check = 0 for j in range(n) : f = num%2 nu...
[["+", 36, 36, 36, 36, 0, 656, 0, 596, 0, 487], ["+", 36, 36, 0, 656, 0, 596, 141, 673, 0, 22], ["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
206
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; int c[n], a[12][12] = {}; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } int ans = 101001001; for (int bit = 0; bit < (1 << n); bit++) { int cost ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; int c[n], a[12][12] = {}; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } int ans = 1001001001; for (int bit = 0; bit < (1 << n); bit++) { int cost...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
259
#include <iostream> #include <vector> const int INF = 1001001001; 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]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } int ans = INF; for (int s = 0...
#include <iostream> #include <vector> const int INF = 1001001001; 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]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } int ans = INF; for (int s = 0...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67]]
1
268
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) using P = pair<int, int>; 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 < b) { ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < n; i++) using P = pair<int, int>; 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 < b) { ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
410
N,M,X = map(int,input().split()) A = [] cost = [] for i in range(N): a = list(map(int,input().split())) A.append(a[1:]) cost.append(a[0]) ans = float('inf') for i in range(2**N): I = bin(i)[2:] I = I.zfill(M) tmp = [0]*M buy = 0 for j in range(len(I)): if I[j]=='1': f...
N,M,X = map(int,input().split()) A = [] cost = [] for i in range(N): a = list(map(int,input().split())) A.append(a[1:]) cost.append(a[0]) ans = float('inf') for i in range(2**N): I = bin(i)[2:] I = I.zfill(N) tmp = [0]*M buy = 0 for j in range(len(I)): if I[j]=='1': f...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
217
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define INF 1000000000000 using namespace std; using ll = long long; using ld = long double; int main() { int n, m; ll x; cin >> n >> m >> x; vector<ll> c(n); vector<vector<ll>> a(n, vector<ll>(m)); vector<ll> sums(m); ll sum_b = 0;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define INF 1000000000000 using namespace std; using ll = long long; using ld = long double; int main() { int n, m; ll x; cin >> n >> m >> x; vector<ll> c(n); vector<vector<ll>> a(n, vector<ll>(m)); vector<ll> sums(m); ll sum_b = 0;...
[["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
295
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std;...
#include <algorithm> #include <bitset> #include <cassert> #include <complex> #include <cstdio> #include <cstring> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std;...
[["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22]]
1
2,675
import sys import numpy as np def Ii():return int(sys.stdin.buffer.read()) def Mi():return map(int,sys.stdin.buffer.readline().split()) def Li():return list(map(int,sys.stdin.buffer.readline().split())) n,m,x = Mi() a = [] b=[0]*m b = np.array(b) for i in range(n): a.append(Li()) ans = 10**5+1 def DFS(cost,star...
import sys import numpy as np def Ii():return int(sys.stdin.buffer.read()) def Mi():return map(int,sys.stdin.buffer.readline().split()) def Li():return list(map(int,sys.stdin.buffer.readline().split())) n,m,x = Mi() a = [] b=[0]*m b = np.array(b) for i in range(n): a.append(Li()) ans = 10**7 def DFS(cost,start,...
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 57, 15, 666, 0, 657, 31, 657, 12, 612], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 17, 72], ["-", 0, 656, 0, 57, 15, 666, 0, 65...
5
227
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): n,m,x=map(int,input().split()) l=[list(map(int,input().split())) for _ in range(n)] ans=10**10 for i in range(2 ** n): skill=[0]*m cost=0 for j in range(n): # こ...
import sys sys.setrecursionlimit(10 ** 5 + 10) def input(): return sys.stdin.readline().strip() def resolve(): n, m, x = map(int, input().split()) l = [list(map(int, input().split())) for _ in range(n)] ans = 10**10 for i in range(2 ** n): skill = [0]*m cost = 0 for j in r...
[["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72]]
5
197
#!/usr/bin/env python3 from itertools import combinations # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): N, M, X = map(int, input().split()) CA = [[] for _ in range(N)] for n...
#!/usr/bin/env python3 from itertools import combinations # Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template) def main(): N, M, X = map(int, input().split()) CA = [[] for _ in range(N)] for n...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
188
import itertools N, M, X = map(int, input().split()) a = [list(map(int, input().split())) for l in range(N)] ans = 10**8 for i in range(2**N): score = [0] * M total = 0 for j in range(1,N+1): if ((i >> j) & 1): total += a[j][0] for k in range(M): score[k] +...
import itertools N, M, X = map(int, input().split()) a = [list(map(int, input().split())) for l in range(N)] ans = 10**8 for i in range(2**N): score = [0] * M total = 0 for j in range(N): if ((i >> j) & 1): total += a[j][0] for k in range(M): score[k] += a[...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
159
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) 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>> A(N, vector<int>(M)); rep(i, N) { cin >> C[i]; rep(j, M) { cin >> A[i]...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) 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>> A(N, vector<int>(M)); rep(i, N) { cin >> C[i]; rep(j, M) { cin >> A[i]...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 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, 13], ["-", 0, 14, 8, 9, 0, 9, 0, 43, 39, 78], ["+", 0, 14, 8, 9, 0, 9, 0, 43, 39, 40], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15,...
1
251
#include "bits/stdc++.h" #define rep(i, j) for (int i = 0; i < j; i++) using namespace std; using ll = long long; using P = pair<int, int>; using ull = unsigned long long; int gcd(int x, int y); int fac(ll n, vector<int> num); const int INF = 1001001001; // mint�p�̕ϐ� (10��9��) const int mod = 1000000007; struct mi...
#include "bits/stdc++.h" #define rep(i, j) for (int i = 0; i < j; i++) using namespace std; using ll = long long; using P = pair<int, int>; using ull = unsigned long long; int gcd(int x, int y); int fac(ll n, vector<int> num); const int INF = 1001001001; // mint�p�̕ϐ� (10��9��) const int mod = 1000000007; struct mi...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 107]]
1
978
N, M, X = list(map(int, input().split())) ca_list = [list(map(int, input().split())) for _ in range(N)] c = [ca_list[i][0] for i in range(N)] a = [ca_list[i][1:] for i in range(N)] ans = sum(c) check = False for i in range(2**N): total = 0 skills = [0] * M for j in range(M): if (i >> j) & 1: ...
N, M, X = list(map(int, input().split())) ca_list = [list(map(int, input().split())) for _ in range(N)] c = [ca_list[i][0] for i in range(N)] a = [ca_list[i][1:] for i in range(N)] ans = sum(c) check = False for i in range(2**N): total = 0 skills = [0] * M for j in range(N): if (i >> j) & 1: ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
196
#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 a[12][12]; const int INF = 1001001001; int main() { int ans = INF; int n, m, x; cin >> n >> m >> x; vector<int> c(n); rep(i, n) { cin >> c[i]; rep(j, m) 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 a[12][12]; const int INF = 1001001001; int main() { int ans = INF; int n, m, x; cin >> n >> m >> x; vector<int> c(n); rep(i, n) { cin >> c[i]; rep(j, m) c...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
241
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) typedef long long ll; using namespace std; const int INF = 1001001; int a[12][12]; int main() { ios::sync_with_stdio(false); 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++) typedef long long ll; using namespace std; const int INF = 1001001001; int a[12][12]; int main() { ios::sync_with_stdio(false); int n, m, x; cin >> n >> m >> x; vector<int> c(n); rep(i, n) { cin >> c[i]; rep(j, m) cin >> a[i][...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["-", 0, 11, 12, 69, 28, 69, 341, 342, 0, 22], ["+", 0, 11, 12, 69, 28, 69, 341, 342, 0, 22]]
1
237
import itertools import numpy as np N, M, X = map(int, input().split()) A = [] C = [] for _ in range(N): temp_list = list(map(int, input().split())) A.append(temp_list[1:]) C.append(temp_list[0]) A = np.array(A) C = np.array(C) answer = 10**6 for comb in itertools.product([0, 1], repeat= N): cost = ...
import itertools import numpy as np N, M, X = map(int, input().split()) A = [] C = [] for _ in range(N): temp_list = list(map(int, input().split())) A.append(temp_list[1:]) C.append(temp_list[0]) A = np.array(A) C = np.array(C) answer = 10**9 for comb in itertools.product([0, 1], repeat= N): cost = ...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 667, 47], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 667, 60], ["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
197
// ###### ### ####### ####### ## # ##### ### // ##### // # # # # # # # # # # # # # // ### // # # # # # # # # # # # # // # ### // // ###### ######### # # # # # # ...
// ###### ### ####### ####### ## # ##### ### // ##### // # # # # # # # # # # # # # // ### // # # # # # # # # # # # # // # ### // // ###### ######### # # # # # # ...
[["+", 0, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 0, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 8, 9, 0, 57, 64, 9, 0, 93, 0, 94]]
1
533
#include <bits/stdc++.h> #define max 1000000000 using namespace std; typedef long long ll; int n, m, x; int arr[20]; int mtr[20][20]; int sum[20]; int dp(int pos, int store[]) { int flag = 0; for (int i = 0; i < m; i++) { if (store[i] < x) { flag = 1; break; } } if (flag == 1 && pos == m) ...
#include <bits/stdc++.h> #define max 1000000000 using namespace std; typedef long long ll; int n, m, x; int arr[20]; int mtr[20][20]; int sum[20]; int dp(int pos, int store[]) { int flag = 0; for (int i = 0; i < m; i++) { if (store[i] < x) { flag = 1; break; } } if (flag == 1 && pos == n) ...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22]]
1
389
#include <bits/stdc++.h> using namespace std; int main(void) { int N, M, X; int C[12]; int A[12][12]; cin >> N >> M >> X; for (int i = 0; i < N; i++) { cin >> C[i]; for (int j = 0; j < M; j++) { cin >> A[i][j]; } } int ans = 1234567890; int max = 1 << N; for (int bitmap = 0; bitmap...
#include <bits/stdc++.h> using namespace std; int main(void) { int N, M, X; int C[12]; int A[12][12]; cin >> N >> M >> X; for (int i = 0; i < N; i++) { cin >> C[i]; for (int j = 0; j < M; j++) { cin >> A[i][j]; } } int ans = 1234567890; int max = 1 << N; for (int bitmap = 0; bitmap...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
269
import sys from itertools import combinations, chain from operator import itemgetter from functools import reduce n, m, x = map(int, next(sys.stdin).split()) books = [tuple(map(int, s.split())) for s in sys.stdin] book_combinations = chain.from_iterable(combinations(books, i) f...
import sys from itertools import combinations, chain from operator import itemgetter from functools import reduce n, m, x = map(int, next(sys.stdin).split()) books = [tuple(map(int, s.split())) for s in sys.stdin] book_combinations = chain.from_iterable(combinations(books, i) #...
[["-", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 31, 22]]
5
215
/* 実行時間1s制限の場合10^6 1,000,000 : 余裕をもって間に合う10^7 10,000,000 : おそらく間に合う10^8 100,000,000 : 非常にシンプルな処理 でないと厳しい */ #define rep(i, n) for (int i = 0; i < (int)n; i++) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #include <bits/stdc++.h> #define M_PI 3.14159265358979323846 using namespace std; typedef long...
/* 実行時間1s制限の場合10^6 1,000,000 : 余裕をもって間に合う10^7 10,000,000 : おそらく間に合う10^8 100,000,000 : 非常にシンプルな処理 でないと厳しい */ #define rep(i, n) for (int i = 0; i < (int)n; i++) #define repi(i, a, b) for (int i = int(a); i < int(b); ++i) #include <bits/stdc++.h> #define M_PI 3.14159265358979323846 using namespace std; typedef 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
1,013
import numpy as np import sys n,m,x = map(int,input().split()) input_list = [np.array(list(map(int,input().split()))) for _ in range(n)] temp_fee = sys.maxsize for i in range(n**2): list2 = [np.array([0]*(m+1))] for j in range(n): if (i >> j) &1 == 1: list2.append(input_list[j]) list3 =...
import numpy as np import sys n,m,x = map(int,input().split()) input_list = [np.array(list(map(int,input().split()))) for _ in range(n)] temp_fee = sys.maxsize for i in range(2**n): list2 = [np.array([0]*(m+1))] for j in range(n): if (i >> j) &1 == 1: list2.append(input_list[j]) list3 = ...
[["-", 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
165
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iomanip> // fixed, setprecis...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <iomanip> // fixed, setprecis...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
299
from sys import stdin input = stdin.readline N, M, X = map(int, input().split()) pricelist = [0] * N matrix = [[0] * M for _ in range(N)] for i in range(N): row = list(map(int, input().split())) pricelist[i] = row.pop(0) matrix[i] = row mintotalprice = 10**5 * 12 + 1 for bit in range(N**2): flag = Tru...
from sys import stdin input = stdin.readline N, M, X = map(int, input().split()) pricelist = [0] * N matrix = [[0] * M for _ in range(N)] for i in range(N): row = list(map(int, input().split())) pricelist[i] = row.pop(0) matrix[i] = row mintotalprice = 10**5 * 12 + 1 for bit in range(2**N): flag = Tru...
[["-", 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
219
import numpy as np N, M, X = list(map(int, input().split())) array = np.array([list(map(int, input().split())) for _ in range(N)]) min_C = np.inf conbi = None m = 2**N for i in range(m): tmp = [] for _ in range(N): tmp.append(i%2) i //= 2 sum_array = np.sum(array[np.where(tmp)], axis=0) #print(tmp...
import numpy as np N, M, X = list(map(int, input().split())) array = np.array([list(map(int, input().split())) for _ in range(N)]) min_C = np.inf conbi = None m = 2**N for i in range(m): tmp = [] for _ in range(N): tmp.append(i%2) i //= 2 sum_array = np.sum(array[np.where(tmp)], axis=0) #print(tmp...
[["+", 15, 652, 3, 4, 0, 666, 0, 206, 0, 70], ["+", 3, 4, 0, 666, 0, 206, 206, 663, 0, 612], ["+", 3, 4, 0, 666, 0, 206, 206, 663, 0, 102], ["+", 15, 652, 3, 4, 0, 666, 0, 206, 0, 73]]
5
164
#include <bits/stdc++.h> using namespace std; int main(void) { int N, M, X; int a, b; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N); for (int i = 0; i < N; i++) { cin >> a; C[i] = a; for (int j = 0; j < M; j++) { cin >> b; A[i].push_back(b); } } int resu...
#include <bits/stdc++.h> using namespace std; int main(void) { int N, M, X; int a, b; cin >> N >> M >> X; vector<int> C(N); vector<vector<int>> A(N); for (int i = 0; i < N; i++) { cin >> a; C[i] = a; for (int j = 0; j < M; j++) { cin >> b; A[i].push_back(b); } } int resu...
[["-", 64, 9, 0, 1, 0, 16, 31, 16, 12, 22], ["+", 64, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["-", 0, 9, 0, 1, 0, 16, 31, 16, 12, 13], ["+", 0, 9, 0, 1, 0, 16, 31, 16, 12, 22]]
1
311
def check(idxs_): rikaido = [0 for i in range(m)] cost_ = 0 for i in idxs_: for j in range(m): rikaido[j] += a[i][j] cost_ += c[i] for i in range(m): if rikaido[i] < x: cost_ = 9999999 return cost_ n, m, x = map(int, input().split()) c = [] a = [] fo...
def check(idxs_): rikaido = [0 for i in range(m)] cost_ = 0 for i in idxs_: for j in range(m): rikaido[j] += a[i][j] cost_ += c[i] for i in range(m): if rikaido[i] < x: cost_ = 9999999 return cost_ n, m, x = map(int, input().split()) c = [] a = [] fo...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
213
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { static int ans = Integer.MAX_VALUE; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTok...
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.*; public class Main { static int ans = Integer.MAX_VALUE; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTok...
[["-", 0, 492, 3, 4, 0, 227, 497, 505, 0, 22], ["+", 0, 492, 3, 4, 0, 227, 497, 505, 0, 22]]
3
472
package main import ( "fmt" ) func main() { var n, m, x int fmt.Scanf("%d %d %d", &n, &m, &x) c := make([]int, n) sk := make([][]int, n) for i := 0; i < n; i++ { sk[i] = make([]int, m) fmt.Scan(&c[i]) for j := 0; j < m; j++ { fmt.Scan(&sk[i][j]) } } var sum int mini := 100000000000000000 for bit ...
package main import ( "fmt" ) func main() { var n, m, x int fmt.Scanf("%d %d %d", &n, &m, &x) c := make([]int, n) sk := make([][]int, n) for i := 0; i < n; i++ { sk[i] = make([]int, m) fmt.Scan(&c[i]) for j := 0; j < m; j++ { fmt.Scan(&sk[i][j]) } } var sum int mini := 100000000000000000 for bit ...
[["-", 0, 435, 8, 196, 0, 57, 15, 16, 12, 433], ["+", 0, 435, 8, 196, 0, 57, 15, 16, 12, 433]]
7
337
N,M,X=map(int,input().split()) CA=[list(map(int,input().split())) for i in range(N)] ans=float("inf") for i in range(N**2): ruikei=[0]*M onedan=0 for j in range(N): if ((i>>j)&1): onedan+=CA[j][0] for k in range(1,M+1): ruikei[k-1]+=CA[j][k] #print(onedan)...
N,M,X=map(int,input().split()) CA=[list(map(int,input().split())) for i in range(N)] ans=float("inf") for i in range(2**N): ruikei=[0]*M onedan=0 for j in range(N): if ((i>>j)&1): onedan+=CA[j][0] for k in range(1,M+1): ruikei[k-1]+=CA[j][k] #print(onedan)...
[["-", 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
176
n,m,x=map(int,input().split()) c=[] a=[] for i in range(n): tmp = list(map(int, input().split())) c.append(tmp[0]) a.append(tmp[1:]) result = -1 for i in range(2**n): skill = [0]*m cost = 0 for j in range(m): if (i >> j) & 1 == 0: continue cost += c[j] for s in range(m): skill[s] ...
n,m,x=map(int,input().split()) c=[] a=[] for i in range(n): tmp = list(map(int, input().split())) c.append(tmp[0]) a.append(tmp[1:]) result = -1 for i in range(2**n): skill = [0]*m cost = 0 for j in range(n): if (i >> j) & 1 == 0: continue cost += c[j] for s in range(m): skill[s] +...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
175
import math from collections import defaultdict ml=lambda:map(int,input().split()) ll=lambda:list(map(int,input().split())) ii=lambda:int(input()) ip=lambda:list(input()) ips=lambda:input().split() """========main code===============""" a,b,c=ml() cost=[] for i in range(a): cost.append(ll()) ans=1e18 flag=1 f...
import math from collections import defaultdict ml=lambda:map(int,input().split()) ll=lambda:list(map(int,input().split())) ii=lambda:int(input()) ip=lambda:list(input()) ips=lambda:input().split() """========main code===============""" a,b,c=ml() cost=[] for i in range(a): cost.append(ll()) ans=1e18 flag=1 f...
[["+", 0, 7, 8, 196, 0, 7, 12, 206, 0, 70], ["+", 8, 196, 0, 7, 12, 206, 206, 663, 0, 612], ["+", 8, 196, 0, 7, 12, 206, 206, 663, 0, 102], ["+", 0, 7, 8, 196, 0, 7, 12, 206, 0, 73]]
5
226
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; int table[N][M + 1]; int ans = pow(10, 5) * 12 + 1; for (int i = 0; i < N; i++) { for (int j = 0; j < M + 1; j++) { cin >> table[i][j]; } } for (int bit = 0; bit < (1 << 12); bit++) { bitset...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; int table[N][M + 1]; int ans = pow(10, 5) * 12 + 1; for (int i = 0; i < N; i++) { for (int j = 0; j < M + 1; j++) { cin >> table[i][j]; } } for (int bit = 0; bit < (1 << 12); bit++) { bitset...
[["+", 0, 11, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]]
1
268
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) using namespace std; using ll = long long; using pii = pair<int, int>; const int INF = 2e9; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n, vector<int>(m + 1)); rep(i, n) { rep(j, m + 1) { 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 pii = pair<int, int>; const int INF = 2e9; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n, vector<int>(m + 1)); rep(i, n) { rep(j, m + 1) { cin >> a[i][j]; } }...
[["-", 15, 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], ["-", 15, 16, 12, 23, 0, 16, 12, 23, 0, 25]]
1
259
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; #define INF 1e9 typedef long long ll; typedef pair<int, int> P; int main() { int n, m, x; cin >> n >> m >> x; int a[n][m]; vector<int> c(n); rep(i, n) { cin >> c[i]; rep(j, n) cin >> a[i][j]; } int ans ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; #define INF 1e9 typedef long long ll; typedef pair<int, int> P; int main() { int n, m, x; cin >> n >> m >> x; int a[n][m]; vector<int> c(n); rep(i, n) { cin >> c[i]; rep(j, m) cin >> a[i][j]; } int ans ...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22]]
1
236
n,m,x = map(int,input().split()) a = [list(map(int,input().split())) for x in range(n)] total = [0]*(m+1) flg = False mflg = True min_num = 10**5+1 for i in range(1,2**n): for j in range(n): if ((i >> j) & 1): total = [x + y for (x, y) in zip(a[j], total)] for k in range(m): if total...
n,m,x = map(int,input().split()) a = [list(map(int,input().split())) for x in range(n)] total = [0]*(m+1) flg = False mflg = True min_num = 100100100100100 for i in range(1,2**n): for j in range(n): if ((i >> j) & 1): total = [x + y for (x, y) in zip(a[j], total)] for k in range(m): ...
[["-", 0, 1, 0, 662, 12, 657, 31, 657, 31, 612], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 17, 578], ["-", 0, 1, 0, 662, 12, 657, 31, 657, 12, 612], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
192
N,M,X = map(int,input().split()) li = [] import numpy as np C = [] for _ in range(M): c,*a = map(int,input().split()) li.append(np.array(a)) C.append(c) counter = [] for i in range(1<<N): skill_li = np.zeros(M) sum_price = 0 for k in range(N): if (i>>k) & 1: skill_li += li...
N,M,X = map(int,input().split()) li = [] import numpy as np C = [] for _ in range(N): c,*a = map(int,input().split()) li.append(np.array(a)) C.append(c) counter = [] for i in range(1<<N): skill_li = np.zeros(M).astype(int) sum_price = 0 for k in range(N): if (i>>k) & 1: sk...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 12, 652, 63, 319, 500, 652, 3, 4, 0, 25], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 0, 131], ["+", 0, 1, 0, 662, 12, 652, 63, 319, 319, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
162
#include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int C[13]; int A[13][13]; int tmp[13 * 2][13]; unsigned int ans = ~1; int N, M, X; inline bool check(vector<int> a, int X) { rep(i, M) { if (a[i] <= X) return false; } return true; } vo...
#include <iostream> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; int C[13]; int A[13][13]; int tmp[13 * 2][13]; unsigned int ans = ~1; int N, M, X; inline bool check(vector<int> a, int X) { rep(i, M) { if (a[i] < X) return false; } return true; } voi...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
318
#include <bits/stdc++.h> #define ll long long using namespace std; const int INF = 1000000007; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m, 0)); for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; }...
#include <bits/stdc++.h> #define ll long long using namespace std; const int INF = 1000000007; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m, 0)); for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; }...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
290
#include <iostream> #include <vector> using namespace std; int main(void) { int n, m, x, i, j, ans = 200000, check = 1; int c[12], a[12][12]; cin >> n >> m >> x; for (i = 0; i < n; i++) { cin >> c[i]; for (j = 0; j < m; j++) cin >> a[i][j]; } for (i = 0; i < (1 << n); i++) { vector<int> b(...
#include <iostream> #include <vector> using namespace std; int main(void) { int n, m, x, i, j, ans = 1200001, check = 1; int c[12], a[12][12]; cin >> n >> m >> x; for (i = 0; i < n; i++) { cin >> c[i]; for (j = 0; j < m; j++) cin >> a[i][j]; } for (i = 0; i < (1 << n); i++) { vector<int> b...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
266
from copy import deepcopy N, M, X = [int(i) for i in input().split()] CAS = [[int(i) for i in input().split()] for _ in range(N)] ok = False mi = [float('inf'), *[0]*(M-1)] fs = '{:0' + str(N) + 'b}' for i in range(2**N): s = fs.format(i) t = [0]*M for i, f in enumerate(s): if f == '1': t = [a+b f...
from copy import deepcopy N, M, X = [int(i) for i in input().split()] CAS = [[int(i) for i in input().split()] for _ in range(N)] ok = False mi = [float('inf'), *[0]*(M)] fs = '{:0' + str(N) + 'b}' for i in range(2**N): s = fs.format(i) t = [0]*(M+1) for i, f in enumerate(s): if f == '1': t = [a+b...
[["-", 0, 661, 0, 657, 12, 23, 0, 657, 17, 33], ["-", 0, 661, 0, 657, 12, 23, 0, 657, 12, 612], ["+", 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
203
n,m,x=[int(i) for i in input().split()] c=[] arr=[[] for i in range(n)] for i in range(n): l=[int(i) for i in input().split()] c.append(l[0]) arr[i]=l[1:] inf=10**18 ans=inf limit=2**n for bit in range(1,limit): sum=[0 for i in range(n)] cost=0 for i in range(n): if (1<<i & bit): ...
n,m,x=[int(i) for i in input().split()] c=[] arr=[[] for i in range(n)] for i in range(n): l=[int(i) for i in input().split()] c.append(l[0]) arr[i]=l[1:] inf=10**18 ans=inf limit=2**n for bit in range(1,limit): sum=[0 for i in range(m)] cost=0 for i in range(n): if (1<<i & bit): ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
218
n, m, x = map(int, input().split()) keep = [] ans = 10**10 for i in range(n): c = list(map(int, input().split())) keep.append(c) for j in range(2**n): bag = [0] * n total = 0 check = 1 for k in range(n): if ((j >> k) & 1): for l in range(m): bag[l] += keep[k]...
n, m, x = map(int, input().split()) keep = [] ans = 10**10 for i in range(n): c = list(map(int, input().split())) keep.append(c) for j in range(2**n): bag = [0] * m total = 0 check = 1 for k in range(n): if ((j >> k) & 1): for l in range(m): bag[l] += keep[k][...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
178
#ABC167 N,M,X=map(int,input().split()) c = [] #参考書の値段 a = [] #各参考書に入る理解度 for i in range(N): c_temp, *a_temp = list(map(int, input().split())) # こうすると、2つ目以降をリストで受け取れる c.append(c_temp) a.append(a_temp) price_min = 10000000 for i in range(2**N): price_total = 0 #値段の合計 learn_total = [0] * M #理解度の合計 ...
#ABC167 N,M,X=map(int,input().split()) c = [] #参考書の値段 a = [] #各参考書に入る理解度 for i in range(N): c_temp, *a_temp = list(map(int, input().split())) # こうすると、2つ目以降をリストで受け取れる c.append(c_temp) a.append(a_temp) price_min = 10000000 for i in range(2**N): price_total = 0 #値段の合計 learn_total = [0] * M #理解度の合計 ...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
186
#include <algorithm> #include <cstring> #include <iostream> using namespace std; struct node { int c; int a[15]; } book[15]; int b[15]; int main() { int n, m, x; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> book[i].c; for (int j = 0; j < m; j++) cin >> book[i].a[j]; } int ans = ...
#include <algorithm> #include <cstring> #include <iostream> using namespace std; struct node { int c; int a[15]; } book[15]; int b[15]; int main() { int n, m, x; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> book[i].c; for (int j = 0; j < m; j++) cin >> book[i].a[j]; } int ans = ...
[["+", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 7, 8, 9, 0, 46]]
1
275
#include <bits/stdc++.h> using namespace std; #define rep(i, ss, ee) for (int i = (ss); i < (ee); ++i) using Vi = vector<int>; using VVi = vector<Vi>; const int INF = 1e9; void solve() { int N, M, X; cin >> N >> M >> X; VVi v(N, Vi(M + 1)); for (auto &e1 : v) for (auto &e2 : e1) cin >> e2; int an...
#include <bits/stdc++.h> using namespace std; #define rep(i, ss, ee) for (int i = (ss); i < (ee); ++i) using Vi = vector<int>; using VVi = vector<Vi>; const int INF = 1e9; void solve() { int N, M, X; cin >> N >> M >> X; M++; VVi v(N, Vi(M)); for (auto &e1 : v) for (auto &e2 : e1) cin >> e2; int...
[["+", 0, 14, 8, 9, 0, 1, 0, 27, 28, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 27, 17, 29], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 51, 4, 0, 2, 3, 4, 0, 16, 17, 72], ["-", 51, 4, 0, 2, 3, 4, 0, 16, 12, 13]]
1
264
#include <algorithm> #include <cstring> #include <iostream> using namespace std; struct node { int c; //每本书的价格 int a[15]; //这本书能够提升Ta的第j个算法多少等级 } book[15]; //储存每一本书的信息 int b[15]; //统计每个子集能够提升第j个算法的总的等级数 int main() { int n, m, x; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> book[i].c;...
#include <algorithm> #include <cstring> #include <iostream> using namespace std; struct node { int c; int a[15]; } book[15]; int b[15]; int main() { int n, m, x; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> book[i].c; for (int j = 0; j < m; j++) cin >> book[i].a[j]; } int ans = 2...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
280
N, M, X = [int(i) for i in input().split()] CA = [] for i in range(N): CA.append([int(j) for j in input().split()]) #print(CA) mcost = 10**10 for i in range(2**N): learn = [0]*M cost = 0 bn = str(bin(i))[2:].zfill(M) #print(bn) for j,b in enumerate(bn): if b == "1": cost +=...
N, M, X = [int(i) for i in input().split()] CA = [] for i in range(N): CA.append([int(j) for j in input().split()]) #print(CA) mcost = 10**10 for i in range(2**N): learn = [0]*M cost = 0 bn = str(bin(i))[2:].zfill(N) #print(bn) for j,b in enumerate(bn): if b == "1": cost +=...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
184
n,m,x = map(int,input().split()) book = [list(map(int,input().split())) for _ in range(n)] ans = 12 * (10**5) + 1 for i in range(2**n): kingaku = 0 rikaido = [0] * m for j in range(n): if (i >> j) & 1: kingaku += book[j][0] for k in range(m): rikaido[k] += boo...
n,m,x = map(int,input().split()) books = [list(map(int,input().split())) for _ in range(n)] ans = 12 * (10**5) + 1 for i in range(2**n): kingaku = 0 rikaido = [0] * m for j in range(n): if (i >> j) & 1: kingaku += books[j][0] for k in range(m): rikaido[k] += b...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 0, 1, 0, 677, 12, 206, 51, 206, 51, 22], ["+", 0, 1, 0, 677, 12, 206, 51, 206, 51, 22], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72]]
5
168
#include <bits/stdc++.h> using namespace std; using ll = long long; int a[15][15]; int c[15]; int main() { int n, m, x; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; } int ans = 1001001001; for (int bit = 0; bit < (1 << n); bit++) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int a[15][15]; int c[15]; int main() { int n, m, x; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; } int ans = 1001001001; for (int bit = 0; bit < (1 << n); bit++) ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
269
if __name__ == '__main__': n,m,a = map(int,input().split()) A = [] for i in range(n): cmd = list(map(int,input().split())) A.append(cmd) print(A) #bit全探索 買う・買わないを判断する INF = 10**19 ans = INF for x in range(2**n): ALG = [0]*m gokei = 0 for y in ra...
if __name__ == '__main__': n,m,a = map(int,input().split()) A = [] for i in range(n): cmd = list(map(int,input().split())) A.append(cmd) #bit全探索 買う・買わないを判断する INF = 10**19 ans = INF for x in range(2**n): ALG = [0]*m gokei = 0 for y in range(n): ...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
190