buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
n,m,x=map(int,input().split()) a=[] for c in range(n): a.append([int(x) for x in input().split()]) s=10**5+1 for d in range(2**n): p=0 q=[0]*m for e in range(n): if (d%(2**(e+1)))//(2**e)==1: p+=a[e][0] for f in range(m): q[f]+=a[e][f+1] if s<p: ...
n,m,x=map(int,input().split()) a=[] for c in range(n): a.append([int(x) for x in input().split()]) s=10**7 for d in range(2**n): p=0 q=[0]*m for e in range(n): if (d%(2**(e+1)))//(2**e)==1: p+=a[e][0] for f in range(m): q[f]+=a[e][f+1] if s<p: ...
[["-", 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
197
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, s, n) for (int i = (s); i < (n); i++) #define all(v) v.begin(), v.end() #define outve(v) \ for (auto i : v) ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define reps(i, s, n) for (int i = (s); i < (n); i++) #define all(v) v.begin(), v.end() #define outve(v) \ for (auto i : v) ...
[["-", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78], ["+", 0, 56, 49, 185, 54, 55, 0, 56, 39, 78], ["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13]]
1
538
import java.util.Scanner; public class Main { private static int m = 0; private static int x = 0; public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); m = scan.nextInt(); x = scan.nextInt(); int[][] c = new int[n][m + 1]; for (int row ...
import java.util.Scanner; public class Main { private static int m = 0; private static int x = 0; public static void main(String args[]) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); m = scan.nextInt(); x = scan.nextInt(); int[][] c = new int[n][m + 1]; for (int row ...
[["-", 64, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 64, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 0, 1, 0, 11, 12, 504, 71, 16, 17, 72], ["+", 0, 1, 0, 11, 12, 504, 71, 16, 12, 499], ["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499]]
3
366
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = a; i < b; ++i) #define rrep(i, a, b) for (int i = a; i >= b; --i) #define fore(i, a) for (auto &i :...
#define _USE_MATH_DEFINES #include <algorithm> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <set> #include <string> #include <vector> #define rep(i, a, b) for (int i = a; i < b; ++i) #define rrep(i, a, b) for (int i = a; i >= b; --i) #define fore(i, a) for (auto &i :...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 152], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 151]]
1
791
from itertools import combinations n, m, x = list(map(int, input().split())) c = [] a = [] # c, aにデータを用意 for i in range(n): tmp = list(map(int, input().split())) c.append(tmp[0]) a.append([]) for j in range(m): a[i].append(tmp[j]) money_min = -1 comb = [] # 組み合わせの数 1 - n for l in range(n...
from itertools import combinations n, m, x = list(map(int, input().split())) c = [] a = [] # c, aにデータを用意 for i in range(n): tmp = list(map(int, input().split())) c.append(tmp[0]) a.append([]) for j in range(1, m + 1): a[i].append(tmp[j]) money_min = -1 comb = [] # 組み合わせを用意 for l in range...
[["+", 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
247
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<long long> possible; vector<vector<int>> v(n, vector<int>(m + 1)); for (int i = 0; i < n; i++) { for (int j = 0; j <= m; j++) { cin >> v[i][j]; } } // Applying bitmasking to get work done ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<long long> possible; vector<vector<int>> v(n, vector<int>(m + 1)); for (int i = 0; i < n; i++) { for (int j = 0; j <= m; j++) { cin >> v[i][j]; } } // Applying bitmasking to get work done ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
379
#bit全探索 n,m,x=map(int,input().split()) a=[] for i in range(n): ai=list(map(int,input().split())) a.append(ai) maxi=[0 for i in range(m)] for i in range(n): for j in range(m): maxi[j]+=a[i][j+1] for i in range(m): if maxi[i]<x: print(-1) exit() mini=100000000 #全探索 for i in range...
#bit全探索 n,m,x=map(int,input().split()) a=[] for i in range(n): ai=list(map(int,input().split())) a.append(ai) #可能判定 maxi=[0 for i in range(m)] for i in range(n): for j in range(m): maxi[j]+=a[i][j+1] for i in range(m): if maxi[i]<x: print(-1) exit() mini=100000000 #全探索 for i in...
[["-", 8, 196, 0, 57, 15, 23, 0, 679, 17, 355], ["+", 8, 196, 0, 57, 15, 23, 0, 657, 17, 67]]
5
249
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string.h> #include <string> #include <u...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iostream> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string.h> #include <string> #include <u...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
533
def n0():return int(input()) def n1():return [int(x) for x in input().split()] def n2(n):return [int(input()) for _ in range(n)] def n3(n):return [[int(x) for x in input().split()] for _ in range(n)] n,m,x=n1() ca=n3(n) ca ans=9999999999 import itertools book=list(itertools.product([0,1], repeat=n)) price=[] for line...
def n0():return int(input()) def n1():return [int(x) for x in input().split()] def n2(n):return [int(input()) for _ in range(n)] def n3(n):return [[int(x) for x in input().split()] for _ in range(n)] n,m,x=n1() ca=n3(n) ans=9999999999 import itertools book=list(itertools.product([0,1], repeat=n)) price=[] for line in...
[["-", 36, 36, 36, 36, 0, 656, 0, 1, 0, 22], ["-", 0, 656, 0, 7, 8, 196, 0, 7, 12, 22], ["+", 0, 7, 8, 196, 0, 7, 12, 652, 63, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 24], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 25]]
5
278
package main import ( "fmt" ) func main() { var N, M, X int fmt.Scan(&N, &M, &X) C := make([]int, N) A := make([][]int, N) for i := 0; i < N; i++ { fmt.Scan(&C[i]) A[i] = make([]int, M) for j := 0; j < M; j++ { fmt.Scan(&A[i][j]) } } ams := int(1e5) for k := 0; k < 1<<uint(N); k++ { cost := 0 ...
package main import ( "fmt" ) func main() { var N, M, X int fmt.Scan(&N, &M, &X) C := make([]int, N) A := make([][]int, N) for i := 0; i < N; i++ { fmt.Scan(&C[i]) A[i] = make([]int, M) for j := 0; j < M; j++ { fmt.Scan(&A[i][j]) } } ams := int(1e9) for k := 0; k < 1<<uint(N); k++ { cost := 0 ...
[["-", 0, 431, 12, 432, 0, 2, 3, 4, 0, 445], ["+", 0, 431, 12, 432, 0, 2, 3, 4, 0, 445], ["-", 0, 57, 15, 16, 12, 2, 3, 4, 0, 445], ["+", 0, 57, 15, 16, 12, 2, 3, 4, 0, 445]]
7
312
n, m, x = map(int, input().split()) books = [] book_total_price = [] for _ in range(n): book = list(map(int, input().split())) books.append(book) for i in range(n ** 2): reference_book = [] book_price = 0 for j in range(n): if (i >> j) & 1: reference_book.append(books[j]) ...
n, m, x = map(int, input().split()) books = [] book_total_price = [] for _ in range(n): book = list(map(int, input().split())) books.append(book) for i in range(2**n): reference_book = [] book_price = 0 for j in range(n): if (i >> j) & 1: reference_book.append(books[j]) ...
[["-", 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
179
n, m, x = map(int, input().split()) books = [] ans = float('inf') for _ in range(n): book = list(map(int, input().split())) books.append(book) for i in range(n**2): count = [0] * m book_price = 0 for j in range(n): if (i >> j) & 1: book_price += books[j][0] for k in ...
n, m, x = map(int, input().split()) books = [] ans = float('inf') for _ in range(n): book = list(map(int, input().split())) books.append(book) for i in range(2**n): count = [0] * m book_price = 0 for j in range(n): if (i >> j) & 1: book_price += books[j][0] for k in ...
[["-", 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
183
// Vicfred // https://atcoder.jp/contests/abc167/tasks/abc167_c #include <algorithm> #include <climits> #include <iostream> #include <vector> 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 (long lon...
// Vicfred // https://atcoder.jp/contests/abc167/tasks/abc167_c #include <algorithm> #include <climits> #include <iostream> #include <vector> 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 (long lon...
[["-", 0, 218, 8, 9, 0, 37, 0, 16, 17, 19], ["+", 0, 218, 8, 9, 0, 37, 0, 16, 17, 18]]
1
297
import numpy as np,sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,M,X = LI() CA = np.array([LI() for _ in range(N)]) ans = float('INF') for i in range(N**2): bit = np.array([[i>>j&1 for j in range(N)]]).T temp = (CA*bit).sum(axis=0) if (temp[1:]>=X).all(): ans = min(ans,...
import numpy as np,sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,M,X = LI() CA = np.array([LI() for _ in range(N)]) ans = float('INF') for i in range(2**N): bit = np.array([[i>>j&1 for j in range(N)]]).T temp = (CA*bit).sum(axis=0) if (temp[1:]>=X).all(): ans = min(ans,...
[["-", 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
162
import numpy as np,sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,M,X = LI() CA = np.array([LI() for _ in range(N)]) ans = float('INF') for i in range(2**N): bit = np.array([[i>>j&1 for j in range(N)]]).T temp = np.sum(CA*bit,axis=0).tolist() temp2 = [] temp2.append(temp) ...
import numpy as np,sys def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) N,M,X = LI() CA = np.array([LI() for _ in range(N)]) ans = float('INF') for i in range(2**N): bit = np.array([[i>>j&1 for j in range(N)]]).T temp = np.sum(CA*bit,axis=0).tolist() temp2 = [] temp2.append(temp) ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
179
N,M,X=list(map(int,input().split())) lines = [] for i in range(N): lines.append(list(map(int,input().split()))) pricemin = 1500000 for i in range(2**N): price = 0 count = 0 A = [0]*M for j in range(N): if ((i >> j) & 1): for k in range(M): A[k] += lines[j][k+1] price += lines[j][0] for j in range(M):...
N,M,X=list(map(int,input().split())) lines = [] for i in range(N): lines.append(list(map(int,input().split()))) pricemin = 1500000 for i in range(2**N): price = 0 count = 0 A = [0]*M for j in range(N): if ((i >> j) & 1): for k in range(M): A[k] += lines[j][k+1] price += lines[j][0] for j in range(M):...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
177
# coding: utf-8 N, M, X = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(N)] n = len(C) m = -1 for i in range(2 ** n): A = [0 for i in range(M+1)] total = 0 for j in range(n): if((i >> j) & 1): A = [a + b for a, b in zip(A, C[j])] B = [k for k i...
# coding: utf-8 N, M, X = map(int, input().split()) C = [list(map(int, input().split())) for _ in range(N)] n = len(C) m = -1 for i in range(2 ** n): A = [0 for i in range(M+1)] total = 0 for j in range(n): if((i >> j) & 1): A = [a + b for a, b in zip(A, C[j])] B = [k for k i...
[["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 21], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
179
#include <bits/stdc++.h> #include <iostream> #include <set> #include <vector> using namespace std; void st(set<vector<int>> &s, vector<int> &ns, vector<int> temp) { if (temp.size() >= ns.size()) return; for (int i = 0; i < ns.size(); i++) { if (temp.size() == 0) { temp.push_back(ns[i]); s.inser...
#include <bits/stdc++.h> #include <iostream> #include <set> #include <vector> using namespace std; void st(set<vector<int>> &s, vector<int> &ns, vector<int> temp) { if (temp.size() >= ns.size()) return; for (int i = 0; i < ns.size(); i++) { if (temp.size() == 0) { temp.push_back(ns[i]); s.inser...
[["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
1
527
from itertools import combinations N,M,X=[int(x) for x in input().split()] L=[] for _ in range(N): L.append([int(x) for x in input().split()]) Smin=-1 for i in range(N): for t in combinations(L,i): S=0 A=[0]*M for l in t: S+=l[0] for x in range(M): A[x]+=l[1+x] ok=True for x...
from itertools import combinations N,M,X=[int(x) for x in input().split()] L=[] for _ in range(N): L.append([int(x) for x in input().split()]) Smin=-1 for i in range(N): for t in combinations(L,i+1): S=0 A=[0]*M for l in t: S+=l[0] for x in range(M): A[x]+=l[1+x] ok=True for...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
165
#include <bits/stdc++.h> using namespace std; using lint = long long; const lint inf = 1LL << 60; const lint mod = 1000000007; template <class T> bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; } template <class T> bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; } int main() { ci...
#include <bits/stdc++.h> using namespace std; using lint = long long; const lint inf = 1LL << 60; const lint mod = 1000000007; template <class T> bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; } template <class T> bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; } int main() { ci...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
387
// ConsoleApplication1.cpp : Defines the entry point for the console // application. // #include <algorithm> #include <iostream> #include <string> #include <vector> #define MAXCHAR 255 using namespace std; int numberOfBooks = 0; int numberOfAlgs = 0; int minimumLev = 0; int cost = -1; vector<pair<int, vector<int>>>...
// ConsoleApplication1.cpp : Defines the entry point for the console // application. // #include <algorithm> #include <iostream> #include <string> #include <vector> #define MAXCHAR 255 using namespace std; int numberOfBooks = 0; int numberOfAlgs = 0; int minimumLev = 0; int cost = -1; vector<pair<int, vector<int>>> ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["+", 8, 9, 0, 57, 64, 9, 0, 116, 0, 117]]
1
590
import numpy as np x,m,n = map(int, input().split()) acq2 = 0 cost = [] skill = [] for i in range(n): ca = list(map(int, input().split())) cost.append(ca[0]) skill.append(np.array(ca[1:])) costmin = 0 for a in range(n): costmin += cost[a] def tworaw(num): if (num % 2 == 0): return 0 e...
import numpy as np n,m,x = map(int, input().split()) acq2 = 0 cost = [] skill = [] for i in range(n): ca = list(map(int, input().split())) cost.append(ca[0]) skill.append(np.array(ca[1:])) costmin = 0 for a in range(n): costmin += cost[a] def tworaw(num): if (num % 2 == 0): return 0 e...
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22]]
5
267
import numpy as np from itertools import combinations n,m,x = map(int, input().split()) n_num = [_ for _ in range(n)] l = np.array([list(map(int, input().split())) for _ in range(n)]) ptns = [] for i in range(n): ptns += list(combinations(n_num, i+1)) ans = float('inf') for j in range(len(ptns)): tmp = np....
import numpy as np from itertools import combinations n,m,x = map(int, input().split()) n_num = [_ for _ in range(n)] l = np.array([list(map(int, input().split())) for _ in range(n)]) ptns = [] for i in range(n): ptns += list(combinations(n_num, i+1)) ans = float('inf') for j in range(len(ptns)): tmp = np....
[["-", 3, 4, 0, 206, 206, 663, 0, 664, 17, 33], ["-", 3, 4, 0, 206, 206, 663, 0, 664, 28, 612]]
5
196
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; using pqM = priority_queue<int>; using pqm = priority_queue<int, vector<int>, greater<int>>; using q = queu...
#include <algorithm> #include <iostream> #include <map> #include <queue> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; using ll = long long; using P = pair<int, int>; using pqM = priority_queue<int>; using pqm = priority_queue<int, vector<int>, greater<int>>; using q = queu...
[["+", 0, 1, 0, 2, 3, 4, 0, 25, 0, 35], ["-", 0, 14, 8, 9, 0, 9, 0, 1, 0, 35]]
1
283
# coding: utf-8 # Your code here! n,m,k = map(int,input().split()) listA=[] #appendのために宣言が必要 while True: try: listA.append(list(map(int,input().split()))) except: break; #または、quit(),os.exit()をして止める。 x=[[0] * (m+1) for i in range(2**n)] #print(listA) for i in range(2 ** n): for j i...
# coding: utf-8 # Your code here! n,m,k = map(int,input().split()) listA=[] #appendのために宣言が必要 while True: try: listA.append(list(map(int,input().split()))) except: break; #または、quit(),os.exit()をして止める。 x=[[0] * (m+1) for i in range(2**n)] #print(listA) for i in range(2 ** n): for j i...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
224
N, M, X = map(int, input().split()) #N=参考書の冊数, 縦,M=学びたいアルゴリズムの数, 横,X=目標の理解度 S = [ input().split() for _ in range(N)] mintotal = 10 ** 9 for i in range(2 ** N): alg = [0 for _ in range(M)] #bag = [] total = 0 #print("pattern {}:".format(i), end="") for j in range(N): if ((i >> j) & 1): ...
N, M, X = map(int, input().split()) #N=参考書の冊数, 縦,M=学びたいアルゴリズムの数, 横,X=目標の理解度 S = [ input().split() for _ in range(N)] mintotal = 10 ** 9 for i in range(2 ** N): alg = [0 for _ in range(M)] #bag = [] total = 0 #print("pattern {}:".format(i), end="") for j in range(N): if ((i >> j) & 1): ...
[["-", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612], ["+", 0, 656, 0, 57, 15, 666, 0, 657, 12, 612]]
5
173
n,m,x=map(int,input().split()) arr=[[0 for i in range(m+1)] for j in range(n)] b=[0]*18 flag=1 for i in range(n): arr[i]=list(map(int,input().split())) for i in range(2**n): b=[0]*18 for j in range(n): flag=1 if (1& i>>j): for s in range(m+1): b[s]= b[s]+arr[j][s...
n,m,x=map(int,input().split()) arr=[[0 for i in range(m+1)] for j in range(n)] b=[0]*18 ans=-1 flag=1 for i in range(n): arr[i]=list(map(int,input().split())) for i in range(2**n): b=[0]*18 for j in range(n): flag=1 if (1& i>>j): for s in range(m+1): b[s]= b[s]+ar...
[["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 0, 656, 0, 1, 0, 662, 12, 664, 28, 612]]
5
194
n,m,x = map(int,input().split()) ca = [list(map(int,input().split())) for _ in range(n)] c = [ca[i][0] for i in range(n)] a = [ca[i][1:] for i in range(n)] ans = 0 cost = sum(c) for i in range(2**n): kari = 0 skill = [0] * m for j in range(n): if (i >> j) & 1: kari += c[j] s...
n,m,x = map(int,input().split()) ca = [list(map(int,input().split())) for _ in range(n)] c = [ca[i][0] for i in range(n)] a = [ca[i][1:] for i in range(n)] ans = 0 cost = sum(c) for i in range(2**n): kari = 0 skill = [0] * m for j in range(n): if (i >> j) & 1: kari += c[j] s...
[["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 17, 33], ["+", 0, 1, 0, 652, 3, 4, 0, 664, 28, 612]]
5
198
#include <bits/stdc++.h> using namespace std; typedef long int li; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, m, x; cin >> n >> m >> x; vector<vector<ll>> v(n, vector<ll>(m + 1, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j <= m; j++) { cin >> v[i][...
#include <bits/stdc++.h> using namespace std; typedef long int li; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(0); ll n, m, x; cin >> n >> m >> x; vector<vector<ll>> v(n, vector<ll>(m + 1, 0)); for (int i = 0; i < n; i++) { for (int j = 0; j <= m; j++) { cin >> v[i][...
[["-", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["+", 0, 43, 49, 50, 51, 16, 31, 16, 12, 13], ["-", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13], ["+", 15, 339, 51, 16, 12, 16, 31, 16, 12, 13]]
1
292
#!/usr/bin/python3 import copy (n, m, x) = map(int, input().split()) b = [] for i in range(n): b.append(tuple(map(int, input().split()))) bss = [[ 0 for i in range(m + 1)]] mc = -1 for i in range(n): nbss = copy.copy(bss) for bs in bss: #print(bs, b[i]) nbs = list(map(lambda x, y: x + y...
#!/usr/bin/python3 import copy (n, m, x) = map(int, input().split()) b = [] for i in range(n): b.append(tuple(map(int, input().split()))) bss = [[ 0 for i in range(m + 1)]] mc = -1 for i in range(n): nbss = copy.copy(bss) for bs in bss: #print(bs, b[i]) nbs = list(map(lambda x, y: x + y...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
178
n,m,x=map(int,input().split()) a=[] ans=-1 t=[0]*(m+1) for i in range(n): a.append(list(map(int,input().split()))) for i in range(2 ** n): for j in range(n): if (i >> j) & 1: for lnd,l in enumerate(a[j]): t[lnd]+=l if ans==-1 or ans > t[0]: if min(t[1:m]) >= x: ...
n,m,x=map(int,input().split()) a=[] ans=-1 t=[0]*(m+1) for i in range(n): a.append(list(map(int,input().split()))) for i in range(2 ** n): for j in range(n): if (i >> j) & 1: for lnd,l in enumerate(a[j]): t[lnd]+=l if ans==-1 or ans > t[0]: if min(t[1:m+1]) >= x: ...
[["+", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72], ["+", 3, 4, 0, 206, 206, 663, 0, 657, 12, 612]]
5
158
from sys import stdin input = stdin.readline ans = 10 ** 10 N, M, X = map(int, input().strip().split()) C = [] A = [[]] * N for i in range(N): tmp = list(map(int, input().strip().split())) C.append(tmp[0]) A[i] = tmp[1:] for i in range(2 ** N - 1): tans = 0 tA = [0] * M for j in range(N): ...
from sys import stdin input = stdin.readline ans = 10 ** 10 N, M, X = map(int, input().strip().split()) C = [] A = [[]] * N for i in range(N): tmp = list(map(int, input().strip().split())) C.append(tmp[0]) A[i] = tmp[1:] for i in range(2 ** N): tans = 0 tA = [0] * M for j in range(N): ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
212
#include <bits/stdc++.h> #include <cmath> #include <math.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vs = vector<string>; using vvs = vector<vs>; using vc = vector<char>; using vvc = vector<vc>; using vb = vector<boo...
#include <bits/stdc++.h> #include <cmath> #include <math.h> using namespace std; using ll = long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vs = vector<string>; using vvs = vector<vs>; using vc = vector<char>; using vvc = vector<vc>; using vb = vector<boo...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 75, 76, 0, 9, 0, 7, 8, 9, 0, 46], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 46]]
1
789
import itertools n, m, x = list(map(int, input().split())) result=[] books=[] tmp=[] for i in range(n): books.append(list(map(int, input().split()))) tmp.append(i) # 参考書の選択パターン作成 patterns=[] for i in range(n): patterns.append(itertools.combinations(tmp,i+1)) # 全ての参考書を購入しても条件を満たせないときは-1 for arg in range(m...
import itertools n, m, x = list(map(int, input().split())) result=[] books=[] tmp=[] for i in range(n): books.append(list(map(int, input().split()))) tmp.append(i) # 参考書の選択パターン作成 patterns=[] for i in range(n): patterns.append(itertools.combinations(tmp,i+1)) # 全ての参考書を購入しても条件を満たせないときは-1 for arg in range(m)...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22]]
5
218
'use strict'; const pipe = Symbol(); Function.prototype[pipe] = function(nextFunc) { const that = this; return function(I) { return nextFunc(that(I)); } } function pre0(input) { return input.split(/\n|\r/).map(str => str.split(/\s+/).map(x => x - 0)); } function pre1(Arr) { const NMX...
'use strict'; const pipe = Symbol(); Function.prototype[pipe] = function(nextFunc) { const that = this; return function(I) { return nextFunc(that(I)); } } function pre0(input) { return input.split(/\n|\r/).map(str => str.split(/\s+/).map(x => x - 0)); } function pre1(Arr) { const NMX...
[["-", 8, 556, 0, 1, 0, 564, 31, 69, 71, 22], ["+", 8, 556, 0, 1, 0, 564, 31, 69, 71, 22], ["+", 51, 2, 3, 3, 0, 568, 8, 2, 63, 22], ["+", 3, 3, 0, 568, 8, 2, 3, 3, 0, 24], ["+", 3, 3, 0, 568, 8, 2, 3, 3, 0, 25], ["+", 3, 3, 0, 568, 8, 2, 3, 3, 0, 22], ["+", 3, 3, 0, 568, 8, 2, 3, 3, 0, 21]]
2
468
#define rep(i, n) for (int i = 0; i < (n); i++) #include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); int a[n][m]; rep(i, n) { cin >> c[i]; rep(j, m) cin >> a[i][j]; } int ans = INT_MAX; rep(i, 1 << n) { int answer = 0; vector<int> ...
#define rep(i, n) for (int i = 0; i < (n); i++) #include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); int a[n][m]; rep(i, n) { cin >> c[i]; rep(j, m) cin >> a[i][j]; } int ans = INT_MAX; rep(i, 1 << n) { int answer = 0; vector<int> ...
[["-", 0, 9, 0, 57, 64, 1, 0, 11, 31, 22], ["+", 0, 9, 0, 57, 64, 1, 0, 11, 31, 22]]
1
207
import java.util.Arrays; import java.util.Scanner; 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(); int[] c = new int[n]; int[][] a = new int[n][m]; for (int i = 0; i < n;...
import java.util.Arrays; import java.util.Scanner; 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(); int[] c = new int[n]; int[][] a = new int[n][m]; for (int i = 0; i < n;...
[["-", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22], ["+", 0, 503, 49, 200, 51, 227, 497, 505, 0, 22]]
3
394
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> ...
// include //------------------------------------------ #include <algorithm> #include <bitset> #include <climits> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <limits> ...
[["-", 8, 9, 0, 57, 15, 339, 51, 11, 17, 32], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60]]
1
557
#include <bits/stdc++.h> using namespace std; typedef long long ll; using Graph = vector<vector<int>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define Rep(i, k, n) for (int i = k; i < (int)(n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; using Graph = vector<vector<int>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define Rep(i, k, n) for (int i = k; i < (int)(n); i++) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 107]]
1
346
line = input() N, M, X = [int(v) for v in line.split(" ")] Ci, Aij = [], [] for i in range(N): line = input().split(" ") line = [int(v) for v in line] Ci.append(line[0]) Aij.append(line[1:]) ans = [] def dfs(candidate): if len(candidate) == M: X_ = [0 for _ in range(M)] cost = 0 ...
line = input() N, M, X = [int(v) for v in line.split(" ")] Ci, Aij = [], [] for i in range(N): line = input().split(" ") line = [int(v) for v in line] Ci.append(line[0]) Aij.append(line[1:]) ans = [] def dfs(candidate): if len(candidate) == N: X_ = [0 for _ in range(M)] cost = 0 ...
[["-", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 14, 8, 196, 0, 57, 15, 666, 0, 22]]
5
230
import numpy as np import sys from itertools import product n, m, x = map(int, input().split()) c = [] A = [] ans = 10**9 products = list(product([0,1], repeat=n)) for _ in range(n): c_a = list(map(int, input().split())) c.append(c_a[0]) A.append(c_a[1:]) min_price = 10**9 for p in products: sum_a...
import numpy as np import sys from itertools import product n, m, x = map(int, input().split()) c = [] A = [] ans = 10**9 products = list(product([0,1], repeat=n)) for _ in range(n): c_a = list(map(int, input().split())) c.append(c_a[0]) A.append(c_a[1:]) min_price = 10**9 for p in products: sum_a...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
197
n,m,x = map(int,input().split()) ca = [list(map(int,input().split())) for i in range(n)] mincost = 10**111 count = 0 for i in range(2**n): li = [0]*m cost = 0 count = 0 for j in range(n): if (i >> j) & 1: cost += ca[j][0] for k in range(m): li[k] += ca[j][k] for l in range(m): if ...
n,m,x = map(int,input().split()) ca = [list(map(int,input().split())) for i in range(n)] mincost = 10**111 for i in range(2**n): li = [0]*m cost = 0 count = 0 for j in range(n): if (i >> j) & 1: cost += ca[j][0] for k in range(m): li[k] += ca[j][1+k] for l in range(m): if li[l] >=...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 0, 32], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 31, 612], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72]]
5
171
import itertools import numpy as np N,M,X = map(int, input().split()) lista = [list(map(int,input().split())) for i in range(N)] lista = np.array(lista) judge = [X]*M cost = 1200001 data = [a for a in range(1,N+1)] # [1,2,3,...,N] for i in range(1,N+1): j = list(itertools.combinations(data, i)) for k in j: r...
import itertools import numpy as np N,M,X = map(int, input().split()) lista = [list(map(int,input().split())) for i in range(N)] lista = np.array(lista) judge = [X]*M cost = 120000000000 data = [a for a in range(1,N+1)] # [1,2,3,...,N] for i in range(1,N+1): j = list(itertools.combinations(data, i)) for k in...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612]]
5
207
def test(): n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(n)] ans = 99999999999999999 for i in range(2 ** n): cost = 0 level = [0] * (m) for j in range(n): if ((i >> j) & 1): cost += books[j][0] ...
def bit(): n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(n)] ans = 99999999999999999 for i in range(2 ** n): cost = 0 level = [0] * (m) for j in range(n): if ((i >> j) & 1): cost += books[j][0] ...
[["-", 36, 36, 36, 36, 0, 656, 0, 14, 141, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 14, 141, 22], ["-", 12, 666, 0, 652, 3, 4, 0, 661, 0, 48], ["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22]]
5
169
import sys from itertools import combinations from collections import Counter ct = Counter() Ass = [] ans = [] N, M, X = map(int, input().split()) for i in range(N): Ass.append(list(map(int, input().split()))) for z in range(M): B = [] for i in range(N): B.append(Ass[i][z]) D = [] for i in range(1, N+1): for...
import sys from itertools import combinations from collections import Counter ct = Counter() Ass = [] ans = [] N, M, X = map(int, input().split()) for i in range(N): Ass.append(list(map(int, input().split()))) for z in range(M): B = [] for i in range(N): B.append(Ass[i][z]) D = [] for i in range(1, N+1): for...
[["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 21]]
5
226
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define N 100005 #define pb push_back #define pv(x) \ cout << #x << ": "; \ for (auto k : x) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define N 100005 #define pb push_back #define pv(x) \ cout << #x << ": "; \ for (auto k : x) { ...
[["-", 8, 9, 0, 7, 8, 9, 0, 93, 0, 94], ["-", 8, 9, 0, 7, 8, 9, 0, 93, 0, 35]]
1
356
/* confirm 0LL and 1LL confirm cornercases such as 0 confirm times of cin < 10^6 */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; using Pld = pair<ld, ld>; using Vec = vector<ll>; using VecP = vector<P>; using VecB = vector<bool>; using VecC = vector...
/* confirm 0LL and 1LL confirm cornercases such as 0 confirm times of cin < 10^6 */ #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using P = pair<ll, ll>; using Pld = pair<ld, ld>; using Vec = vector<ll>; using VecP = vector<P>; using VecB = vector<bool>; using VecC = vector...
[["-", 54, 55, 0, 56, 49, 159, 81, 16, 17, 72], ["-", 54, 55, 0, 56, 49, 159, 81, 16, 12, 13]]
1
788
#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 main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); int a[12][12]; 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 main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); int a[12][12]; rep(i, n) { cin >> c[i]; rep(j, m) cin >> a[i][j]; ...
[["+", 8, 9, 0, 9, 0, 14, 8, 9, 0, 46], ["-", 0, 30, 0, 14, 8, 9, 0, 9, 0, 46]]
1
245
import numpy as np N, M, X = map(int, input().split()) C = np.zeros(N) A = np.zeros((N, M)) for n in range(N): s = list(map(int, input().split())) C[n] = s[0] A[n] = s[1:] C_MIN = -1 for i in range(2 ** N): C_SUM = 0 A_SUM = np.zeros(M) for j in range(N): if ((i >> j) & 1): ...
import numpy as np N, M, X = map(int, input().split()) C = np.zeros(N) A = np.zeros((N, M)) for n in range(N): s = list(map(int, input().split())) C[n] = s[0] A[n] = s[1:] C_MIN = -1 for i in range(2 ** N): C_SUM = 0 A_SUM = np.zeros(M) for j in range(N): if ((i >> j) & 1): ...
[["-", 0, 57, 64, 196, 0, 57, 15, 679, 17, 355], ["-", 64, 196, 0, 57, 15, 679, 12, 681, 0, 372], ["+", 0, 57, 64, 196, 0, 57, 15, 679, 17, 354]]
5
187
from itertools import product n, m, x = map(int, input().split()) costs = [] gets = [] for i in range(n): cost, *argo = map(int, input().split()) costs.append(cost) gets.append(argo) bits_list = list(product([0,1], repeat=n)) min_cost = float('inf') cnt = 0 for bits in bits_list: tmp_cost = 0 ...
from itertools import product n, m, x = map(int, input().split()) costs = [] gets = [] for i in range(n): cost, *argo = map(int, input().split()) costs.append(cost) gets.append(argo) bits_list = list(product([0,1], repeat=n)) min_cost = float('inf') cnt = 0 for bits in bits_list: tmp_cost = 0 ...
[["-", 0, 652, 3, 4, 0, 670, 8, 666, 667, 47], ["+", 0, 652, 3, 4, 0, 670, 8, 666, 667, 20]]
5
189
n,m,x = map(int,input().split()) B=[list(map(int,input().split())) for i in range(n)] ANS = 1 << 100 for i in range(1 << n): SCORE = [0] * m MONEY = 0 for j in range(n): if (1 << j) & i != 0: MONEY+=B[j][0] for k in range(m): SCORE[k] += B[j][k] if min(SCO...
n,m,x = map(int,input().split()) B=[list(map(int,input().split())) for i in range(n)] ANS = 1 << 100 for i in range(1 << n): SCORE = [0] * m MONEY = 0 for j in range(n): if (1 << j) & i != 0: MONEY+=B[j][0] for k in range(m): SCORE[k] += B[j][k+1] if min(S...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
151
def main(): N,M,X=map(int, input().split()) A=[list(map(int, input().split())) for _ in range(N)] ans=10**10 for i in range(2**N): b=i+2**N c=0 l=[0]*M ok=True for j in range(N): if b>>j&1 == 1: c+=A[j][0] for k in range...
def main(): N,M,X=map(int, input().split()) A=[list(map(int, input().split())) for _ in range(N)] ans=10**10 for i in range(2**N): b=i+2**N c=0 l=[0]*M ok=True for j in range(N): if b>>j&1 == 1: c+=A[j][0] for k in range...
[["-", 0, 57, 15, 666, 0, 657, 31, 657, 12, 612], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 17, 48], ["-", 8, 196, 0, 57, 15, 666, 0, 657, 12, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 657, 12, 612]]
5
187
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <climits> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <functional> #incl...
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound #include <bitset> // bitset #include <cctype> // isupper, islower, isdigit, toupper, tolower #include <climits> #include <cstdint> // int64_t, int*_t #include <cstdio> // printf #include <deque> // deque #include <functional> #incl...
[["+", 0, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 0, 9, 0, 43, 49, 50, 51, 4, 0, 13], ["+", 8, 9, 0, 9, 0, 14, 8, 9, 0, 46], ["-", 0, 30, 0, 14, 8, 9, 0, 9, 0, 46]]
1
278
#include <limits.h> #include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define max 100000 // qsort(str, n, sizeof(int), up_comp); int up_comp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int down_comp(con...
#include <limits.h> #include <math.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define rep(i, n) for (int i = 0; i < (n); ++i) #define max 100000 // qsort(str, n, sizeof(int), up_comp); int up_comp(const void *a, const void *b) { return *(int *)a - *(int *)b; } int down_comp(con...
[["-", 0, 9, 0, 57, 15, 23, 0, 16, 17, 67], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 152], ["-", 0, 57, 15, 23, 0, 16, 12, 16, 17, 151], ["+", 0, 9, 0, 57, 15, 23, 0, 16, 17, 67]]
0
455
N, M, X = gets.split.map(&:to_i) BOOKS = N.times.map { cost, *parameters = gets.split.map(&:to_i) [cost, parameters] } def f(mask) total_cost = 0 skills = Array.new(M, 0) N.times do |i| next if mask[i] == 0 cost, parameters = BOOKS[i] total_cost += cost parameters.each_with_index do |x,...
N, M, X = gets.split.map(&:to_i) BOOKS = N.times.map { cost, *parameters = gets.split.map(&:to_i) [cost, parameters] } def f(mask) total_cost = 0 skills = Array.new(M, 0) N.times do |i| next if mask[i] == 0 cost, parameters = BOOKS[i] total_cost += cost parameters.each_with_index do |x,...
[["-", 0, 493, 0, 652, 486, 739, 0, 738, 17, 33], ["-", 0, 493, 0, 652, 486, 739, 0, 738, 12, 612]]
4
169
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace __gnu_pbds; using namespace __gnu_cxx; typ...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace __gnu_pbds; using namespace __gnu_cxx; typ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
343
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll N, M, X, count = 0, answer = 0; cin >> N >> M >> X; vector<vector<ll>> vec(N, vector<ll>(M + 1)); for (ll i = 0; i < N; i++) { for (ll j = 0; j <= M; j++) { cin >> vec.at(i).at(j); answer += vec.at(i).at(0); }...
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll N, M, X, count = 0, answer = 0; cin >> N >> M >> X; vector<vector<ll>> vec(N, vector<ll>(M + 1)); for (ll i = 0; i < N; i++) { for (ll j = 0; j <= M; j++) { cin >> vec.at(i).at(j); } answer += vec.at(i).at(0); ...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
323
#include <stdbool.h> #include <stdio.h> #define rep(i, n) for (int i = 0; i < (n); ++i) const int INF = 100000; int main() { int n, m, x, a[13][13], c[13]; scanf("%d%d%d", &n, &m, &x); rep(i, n) { scanf("%d", &c[i]); rep(j, m) scanf("%d", &a[i][j]); } int ans = INF; rep(s, 1 << n) { int cost ...
#include <stdbool.h> #include <stdio.h> #define rep(i, n) for (int i = 0; i < (n); ++i) const int INF = 100000000; int main() { int n, m, x, a[13][13], c[13]; scanf("%d%d%d", &n, &m, &x); rep(i, n) { scanf("%d", &c[i]); rep(j, m) scanf("%d", &a[i][j]); } int ans = INF; rep(s, 1 << n) { int co...
[["-", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 50, 51, 13]]
0
267
N,M,X = map(int,input().split()) A = [] S = [0 for _ in range(N)] min_value = 0 score=[0 for _ in range(N)] for x in range(N): A.append(list(map(int,input().split()))) for x in range(N): min_value += A[x][0] sucess = 0 for bit in range(2**N): for i in range(N): if (bit >> i) & 1: S.append(A[i...
N,M,X = map(int,input().split()) A = [] S = [0 for _ in range(N)] min_value = 0 score=[0 for _ in range(M)] for x in range(N): A.append(list(map(int,input().split()))) for x in range(N): min_value += A[x][0] sucess = 0 for bit in range(2**N): for i in range(N): if (bit >> i) & 1: S.append(A[i]...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
232
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 9999999999 using namespace std; int main() { int i, j, k, n, m, x, ans = INF; bool f; cin >> n >> m >> x; int c[n], a[n][m], skill[m], cost; rep(i, ...
#include <algorithm> #include <iostream> #include <math.h> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 999999999 using namespace std; int main() { int i, j, k, n, m, x, ans = INF; bool f; cin >> n >> m >> x; int c[n], a[n][m], skill[m], cost; rep(i, n...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
243
#include <bits/stdc++.h> using namespace std; #define fastIO ios::sync_with_stdio(0), cin.tie(0) #define endl '\n' #define ft first #define sd second typedef long long ll; typedef pair<int, int> pii; typedef pair<long long, int> pll; int n, m, x; int valor[13]; int libros[13][13]; int valorMinimo = 10000000; int habil...
#include <bits/stdc++.h> using namespace std; #define fastIO ios::sync_with_stdio(0), cin.tie(0) #define endl '\n' #define ft first #define sd second typedef long long ll; typedef pair<int, int> pii; typedef pair<long long, int> pll; int n, m, x; int valor[13]; int libros[13][13]; int valorMinimo = 10000000; int habil...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
325
#include <bits/stdc++.h> #include <string> #include <unordered_map> #define ll long long using namespace std; const ll INF = 1LL << 60; const int inf = 1 << 30; const int N = 1e5 + 10; inline void fastio() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int main() { int n, m, x, ans = inf; cin >> n...
#include <bits/stdc++.h> #include <string> #include <unordered_map> #define ll long long using namespace std; const ll INF = 1LL << 60; const int inf = 1 << 30; const int N = 1e5 + 10; inline void fastio() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int main() { int n, m, x, ans = inf; cin >> n...
[["+", 0, 43, 49, 80, 49, 80, 81, 16, 17, 72], ["+", 0, 43, 49, 80, 49, 80, 81, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 17, 72], ["+", 8, 9, 0, 43, 49, 80, 81, 16, 12, 13]]
1
337
N, M, X = map(int, input().split()) books = [input() for i in range(N)] result = 12 * 10**5 + 1 for i in range(1, 1 << N): cost = 0 skill = [0 for i in range(N)] for j in range(N): if (i >> j) & 1: book = books[j].split() cost += int(book[0]) for k in range(M): skill[k] += int(book[k...
N, M, X = map(int, input().split()) books = [input() for i in range(N)] result = 12 * 10**5 + 1 for i in range(1, 1 << N): cost = 0 skill = [0 for i in range(M)] for j in range(N): if (i >> j) & 1: book = books[j].split() cost += int(book[0]) for k in range(M): skill[k] += int(book[k...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22]]
5
168
#include <algorithm> #include <cstdio> #include <cstring> using namespace std; typedef long long ll; const ll inf = 1e18; const int N = 15; int a[N]; ll ans; int n, m, book[N][N], x; int main() { scanf("%d%d%d", &n, &m, &x); for (int i = 1; i <= n; i++) { for (int j = 0; j <= m; j++) { scanf("%d", &book[...
#include <algorithm> #include <cstdio> #include <cstring> using namespace std; typedef long long ll; const ll inf = 1e18; const int N = 15; int a[N]; ll ans; int n, m, book[N][N], x; int main() { scanf("%d%d%d", &n, &m, &x); for (int i = 1; i <= n; i++) { for (int j = 0; j <= m; j++) { scanf("%d", &book[...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
316
n, m, x = map(int, input().split()) A = [[] for _ in range(n)] cost = [0] * n for i in range(n): c_as = list(map(int, input().split())) cost[i], A[i] = c_as[0], c_as[1:] INF = 10**9 ans = INF for s in range(0, 1 << n): smart = [0] * m cost_sum = 0 for i in range(n): if (s >> i) % 2 == 0: continue ...
n, m, x = map(int, input().split()) A = [[] for _ in range(n)] cost = [0] * n for i in range(n): c_as = list(map(int, input().split())) cost[i], A[i] = c_as[0], c_as[1:] INF = 10**9 ans = INF for s in range(0, 1 << n): smart = [0] * m cost_sum = 0 for i in range(n): if (s >> i) % 2 == 0: continue ...
[["-", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["+", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22]]
5
205
#include <iostream> using namespace std; int c[20], a[20][20], b[20]; int main(void) { int n, m, x, bc, mn = 1e9; bool d = false; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; } for (int k = 1; k < (1 << n); k++) { int cnt = 0; ...
#include <iostream> using namespace std; int c[20], a[20][20], b[20]; int main(void) { int n, m, x, bc, mn = 1e9; bool d = false; cin >> n >> m >> x; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) cin >> a[i][j]; } for (int k = 0; k < (1 << n); k++) { int cnt = 0; ...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22]]
1
282
n, m, x = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] ans = float('Inf') for i in range(2 ** n): sum_ = [0] * m cost = 0 for j in range(n): #sum_ = [0] * m if ((i >> j) & 1): cost += a[j][0] for k in range(m): sum_...
n, m, x = map(int, input().split()) a = [list(map(int, input().split())) for _ in range(n)] ans = float('Inf') for i in range(2 ** n): sum_ = [0] * m cost = 0 for j in range(n): #sum_ = [0] * m if ((i >> j) & 1): cost += a[j][0] for k in range(m): sum_...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
175
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> avi(n, vector<int>(m)); rep(i, n) { int C; cin >> C; c[i] = C; rep(j, m) { int a; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> avi(n, vector<int>(m)); rep(i, n) { int C; cin >> C; c[i] = C; rep(j, m) { int a; ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
290
from itertools import combinations import numpy as np n,m,x = map(int,input().split()) a_list = [] price_list = [] for _ in range(n): tmp = list(map(int,input().split())) price_list.append(tmp.pop(0)) a_list.append(tmp) all_list = [x for x in range(len(a_list))] prices = [] for i in range(1,len(a_list)...
from itertools import combinations import numpy as np n,m,x = map(int,input().split()) a_list = [] price_list = [] for _ in range(n): tmp = list(map(int,input().split())) price_list.append(tmp.pop(0)) a_list.append(tmp) all_list = [x for x in range(len(a_list))] prices = [] for i in range(1,len(a_list)...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
189
N,M,X = gets.chomp.split.map(&:to_i) C = N.times.map{gets.chomp.split.map(&:to_i)} D = C.transpose count = 0 (1..M).each do |i| if D[i].sum < X count += 1 end end if count != 0 puts "-1" exit end bits = [0, 1].repeated_permutation(N).to_a ans = (10 ** 5) * 12 bits.each do |bit| rikaido = [0] * (M + 1) ...
N,M,X = gets.chomp.split.map(&:to_i) C = N.times.map{gets.chomp.split.map(&:to_i)} D = C.transpose count = 0 (1..M).each do |i| if D[i].sum < X count += 1 end end if count != 0 puts "-1" exit end bits = [0, 1].repeated_permutation(N).to_a ans = (10 ** 5) * 12 bits.each do |bit| rikaido = [0] * (M + 1) ...
[["+", 8, 736, 0, 121, 15, 652, 486, 742, 0, 70], ["+", 0, 121, 15, 652, 486, 742, 0, 475, 756, 612], ["+", 0, 121, 15, 652, 486, 742, 0, 475, 17, 757], ["+", 0, 121, 15, 652, 486, 742, 0, 475, 444, 743], ["+", 8, 736, 0, 121, 15, 652, 486, 742, 0, 73]]
4
196
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) 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.at(i); rep(j, M) cin >> A.at(i).at(j); } int answer = 1000000000; r...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) 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.at(i); rep(j, M) cin >> A.at(i).at(j); } int answer = 1000000000; r...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 67], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 12, 22], ["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 45], ["+", 8, 9, 0, 9, 0, 57, 64, 9, 0, 46]]
1
244
#include <stdio.h> #define rep(i, n) for (int i = 0; i < n; ++i) int a[12][12]; int min(int a, int b) { int temp; if (a > b) return b; if (a <= b) return a; } int main() { int n, m, x; scanf("%d%d%d", &n, &m, &x); int c[n]; rep(i, n) { scanf("%d", &c[i]); rep(j, m) scanf("%d", &a[i][...
#include <stdio.h> #define rep(i, n) for (int i = 0; i < n; ++i) int a[12][12]; int min(int a, int b) { int temp; if (a > b) return b; if (a <= b) return a; } int main() { int n, m, x; scanf("%d%d%d", &n, &m, &x); int c[n]; rep(i, n) { scanf("%d", &c[i]); rep(j, m) scanf("%d", &a[i][...
[["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 7, 8, 9, 0, 57, 64, 9, 0, 46]]
0
329
def function(): N,M,X = map(int, input().split()) maxCost=0 Aij = [] for n in range(0,N): Aj = list(map(int, input().split())) maxCost += Aj[0] Aij.append(Aj) minCost = maxCost total = pow(2, N) for n in range(1,total): x = [0]*M cost = 0 i = ...
def function(): N,M,X = map(int, input().split()) maxCost=0 Aij = [] for n in range(0,N): Aj = list(map(int, input().split())) maxCost += Aj[0] Aij.append(Aj) maxCost += 1 minCost = maxCost total = pow(2, N) for n in range(1,total): x = [0]*M cost...
[["+", 0, 14, 8, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 14, 8, 196, 0, 1, 0, 677, 12, 612]]
5
214
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <map> #include <set> #include <string> #include <vector> #include <numeric> #include <type_traits> using namespace std; const long long INF = (long long)(1e18) + 1; vector<vector<long long>> nums; long long n, m, x; long long ans = -...
#include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <map> #include <set> #include <string> #include <vector> #include <numeric> #include <type_traits> using namespace std; const long long INF = (long long)(1e18) + 1; vector<vector<long long>> nums; long long n, m, x; long long ans = -...
[["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 45], ["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46], ["-", 64, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 64, 9, 0, 57, 75, 76, 0, 9, 0, 46], ["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
408
N, M, X = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(N)] p = [] for i in range(1, 2**N): buff = [0] * M for j in range(N): if i >> j & 1: buff = [a + b for a, b in zip(buff, books[j])] for a in buff[1:]: if a < X: break e...
N, M, X = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(N)] p = [] for i in range(1, 2**N): buff = [0] * (M + 1) for j in range(N): if i >> j & 1: buff = [a + b for a, b in zip(buff, books[j])] for a in buff[1:]: if a < X: break...
[["+", 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
153
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() using ll = long long; int main() { int n, m, x, i, j, ans = 0; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m)); for (i = 0; i < n; i++) { cin >> c[i]; ans += c[i]; for (j = 0; j < m;...
#include <bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() using ll = long long; int main() { int n, m, x, i, j, ans = 0; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m)); for (i = 0; i < n; i++) { cin >> c[i]; ans += c[i]; for (j = 0; j < m;...
[["+", 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]]
1
301
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 100010 using namespace std; using ll = long long; using P = pair<int, int>; int N, M, X; vector<int> C; vector<vector<int>> A; ll ans = INF; void dfs(int ex, int count, int CC, vector<int> XX) { if (count == N) { rep(i, M...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define INF 10000000 using namespace std; using ll = long long; using P = pair<int, int>; int N, M, X; vector<int> C; vector<vector<int>> A; ll ans = INF; void dfs(int ex, int count, int CC, vector<int> XX) { if (count == N) { rep(i,...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
318
def task(n, m, x, c, a): mx = [0] * n for i in range(0, n): for j in range(0, m): mx[j] += a[i][j] for j in range(0, m): if mx[j] < x: print(-1) return states = [0] * m best = 1000000 for i in range(1, (2**n) + 1): price = 0 ...
def task(n, m, x, c, a): mx = [0] * m for i in range(0, n): for j in range(0, m): mx[j] += a[i][j] for j in range(0, m): if mx[j] < x: print(-1) return states = [0] * m best = 100000000 for i in range(1, 2**n): price = 0 for...
[["-", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 12, 652, 3, 4, 0, 657, 31, 23, 0, 24], ["-", 12, 652, 3, 4, 0, 657, 31, 23, 0, 25], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["-...
5
295
#include <bitset> #include <cmath> #include <iostream> #include <vector> using namespace std; using ll = long long; int main(int argc, const char *argv[]) { int N, M, X; cin >> N >> M >> X; vector<int> c(N, 0); vector<int> money; int **A = new int *[N]; for (int i = 0; i < N; i++) { cin >> c[i]; ...
#include <bitset> #include <cmath> #include <iostream> #include <vector> using namespace std; using ll = long long; int main(int argc, const char *argv[]) { int N, M, X; cin >> N >> M >> X; vector<int> c(N, 0); vector<int> money; int **A = new int *[N]; for (int i = 0; i < N; i++) { cin >> c[i]; ...
[["-", 0, 57, 64, 9, 0, 43, 49, 50, 51, 13], ["+", 64, 9, 0, 43, 49, 50, 51, 69, 28, 22], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 70], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 13], ["+", 0, 43, 49, 50, 51, 69, 341, 342, 0, 73], ["-", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 64, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
402
#include <math.h> #include <stdio.h> int main() { int n, m, x, i, j, k; int c[12], a[12][12]; scanf("%d %d %d", &n, &m, &x); for (i = 0; i < n; i++) { scanf("%d", &c[i]); for (j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } int minC = 1200000, flag1 = 0; for (i = 1; i <= pow(2, n) - 1; ...
#include <math.h> #include <stdio.h> int main() { int n, m, x, i, j, k; int c[12], a[12][12]; //入力 scanf("%d %d %d", &n, &m, &x); for (i = 0; i < n; i++) { scanf("%d", &c[i]); for (j = 0; j < m; j++) { scanf("%d", &a[i][j]); } } int minC = 1200000, flag1 = 0; for (i = 1; i <= pow(2, n...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
0
302
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, i, j, k, t_cases, sum, ans, flag; int C[12], A[12][12], level[12]; cin >> n >> m >> x; for (i = 0; i < n; i++) { cin >> C[i]; for (j = 0; j < m; j++) cin >> A[i][j]; } ans = INT_MAX; t_cases = 1 << n; for (i = 0; i < t...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, i, j, k, t_cases, sum, ans, flag; int C[12], A[12][12], level[12]; cin >> n >> m >> x; for (i = 0; i < n; i++) { cin >> C[i]; for (j = 0; j < m; j++) cin >> A[i][j]; } ans = INT_MAX; t_cases = 1 << n; for (i = 0; i < t...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 31, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48]]
1
273
import itertools n,m,x=map(int,input().split()) c=[0]*n a=[[0 for i in range(m)] for j in range(n)] print(a) current_skill=[0]*m INF=9999999 min_money=INF for i in range(n): tmp=list(map(int,input().split())) c[i]=tmp[0] a[i]=tmp[1:] current_money=0 for i in range(1 << n): bug=[] #print('curren...
import itertools n,m,x=map(int,input().split()) c=[0]*n a=[[0 for i in range(m)] for j in range(n)] current_skill=[0]*m INF=9999999 min_money=INF for i in range(n): tmp=list(map(int,input().split())) c[i]=tmp[0] a[i]=tmp[1:] current_money=0 for i in range(1 << n): bug=[] for j in range(n): ...
[["-", 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
226
n,m,x=map(int,input().split()) c=[list(map(int,input().split())) for _ in range(n)] result=-1 for i in range(2**n): t=[0]*m money=0 for j in range(n): if (i>>j)&1==0: continue money+=c[j][0] for k in range(1,m): t[k]+=c[j][k] if all(xx>=x for xx in t): if result==-1: result=mon...
n,m,x=map(int,input().split()) c=[list(map(int,input().split())) for _ in range(n)] result=-1 for i in range(2**n): t=[0]*m money=0 for j in range(n): if (i>>j)&1==0: continue money+=c[j][0] for k in range(1,m+1): t[k-1]+=c[j][k] if all(xx>=x for xx in t): if result==-1: result...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 12, 612]]
5
154
import sys readline = sys.stdin.readline N,M,X = map(int,readline().split()) books = [None] * N for i in range(N): data = list(map(int,readline().split())) cost = data[0] point = data[1:] books[i] = [cost,point] # M個から1個以上M個以下を選ぶ。選ぶ数でループ INF = 10 ** 10 ans = INF import itertools for i in range(1, M + 1): ...
import sys readline = sys.stdin.readline N,M,X = map(int,readline().split()) books = [None] * N for i in range(N): data = list(map(int,readline().split())) cost = data[0] point = data[1:] books[i] = [cost,point] # M個から1個以上M個以下を選ぶ。選ぶ数でループ INF = 10 ** 10 ans = INF import itertools for i in range(1, N + 1): ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
210
n,m,x=map(int, input().split()) c = [] a = [] for i in range(n): t = [int(j) for j in input().split()] c.append(t.pop(0)) a.append(t) me = [x] * m min = sum(c) cost = 0 def f(me, books, ctbl, cost): global min if len(books) == 0: return for i,b in enumerate(books): t = tuple(m...
n,m,x=map(int, input().split()) c = [] a = [] for i in range(n): t = [int(j) for j in input().split()] c.append(t.pop(0)) a.append(t) me = [x] * m min = sum(c)+1 cost = 0 def f(me, books, ctbl, cost): global min if len(books) == 0: return for i,b in enumerate(books): t = tuple...
[["+", 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, 18]]
5
260
#include <algorithm> //sort,二分探索,など //#include<bitset>//固定長bit集合 #include <climits> #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #inclu...
#include <algorithm> //sort,二分探索,など //#include<bitset>//固定長bit集合 #include <climits> #include <cmath> //pow,logなど #include <complex> //複素数 #include <deque> //両端アクセスのキュー #include <functional> //sortのgreater #include <iomanip> //setprecision(浮動小数点の出力の誤差) #include <iostream> //入出力 #inclu...
[["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 12, 146], ["+", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35]]
1
364
from itertools import product N,M,X = map(int,input().split()) ca = [list(map(int,input().split())) for _ in range(N)] for i in range(1,M+1): count=0 for j in range(N): count+=ca[j][i] if count<X: print(-1) exit() ans = 10**9 for z in product((0, 1), repeat=N):#bit全探索のくみあわせを勝手に作ってく...
from itertools import product N,M,X = map(int,input().split()) ca = [list(map(int,input().split())) for _ in range(N)] for i in range(1,M+1): count=0 for j in range(N): count+=ca[j][i] if count<X: print(-1) exit() ans = 10**9 for z in product((0, 1), repeat=N):#bit全探索のくみあわせを勝手に作ってく...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22]]
5
207
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; const ll MOD = 1000000007; // nの2^iの位の数を出力する関数 ll pla(ll n, ll i) { ll x = pow(2, i + 1), y = pow(2, i); return n % x / y; } int main() { ll N, M, X; cin >> N >> M >> X; vector<ll> C(N); vec...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) using ll = long long; const ll MOD = 1000000007; // nの2^iの位の数を出力する関数 ll pla(ll n, ll i) { ll x = pow(2, i + 1), y = pow(2, i); return n % x / y; } int main() { ll N, M, X; cin >> N >> M >> X; vector<ll> C(N); vec...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["-", 15, 339, 51, 16, 31, 2, 3, 4, 0, 22], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 22], ["-", 0, 1, 0, 11, 12, 2, 3, 4, 0, 22], ["+", 0, 1,...
1
337
nmx=list(map(int, input().split())) N=nmx[0] M=nmx[1] X=nmx[2] mylist=[] for i in range(N): mylist.append(list(map(int, input().split()))) Ans=100000*12+1 for i in range(2**N): A=[0]*M C=0 for j in range(N): if (i>>j) & 1: C=C+mylist[j][0] for k in range(M): ...
nmx=list(map(int, input().split())) N=nmx[0] M=nmx[1] X=nmx[2] mylist=[] for i in range(N): mylist.append(list(map(int, input().split()))) Ans=100000*12+1 for i in range(2**N): A=[0]*M C=0 for j in range(N): if (i>>j) & 1: C=C+mylist[j][0] for k in range(M): ...
[["-", 0, 57, 15, 666, 0, 657, 31, 657, 31, 612], ["+", 0, 57, 15, 666, 0, 657, 31, 657, 31, 612]]
5
185
#include <bits/stdc++.h> using namespace std; int main() { int a[12][12]; 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 = INT_MAX; for (int s = 0; s < (1 << n); s++) { int cost =...
#include <bits/stdc++.h> using namespace std; int main() { int a[12][12]; 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 = INT_MAX; for (int s = 0; s < (1 << n); s++) { int cost =...
[["-", 0, 57, 15, 339, 51, 16, 12, 23, 0, 24], ["-", 0, 57, 15, 339, 51, 16, 12, 23, 0, 25], ["-", 0, 7, 8, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 57, 64, 9, 0, 93, 0, 94]]
1
264
from sys import stdin import numpy as np def bit_search(a, n, m, x): min_price = np.inf for i in range(2 ** n): price = 0 skill = np.zeros((n, m)) for j in range(n): if (i >> j) & 1: price += a[j][0] skill[j] = a[j][1:] skill_sum = np....
from sys import stdin import numpy as np def bit_search(a, n, m, x): min_price = np.inf for i in range(2 ** n): price = 0 skill = np.zeros((n, m)) for j in range(n): if (i >> j) & 1: price += a[j][0] skill[j] = a[j][1:] skill_sum = np....
[["-", 8, 196, 0, 1, 0, 662, 12, 41, 0, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 41, 0, 22], ["+", 8, 196, 0, 57, 15, 679, 31, 681, 0, 372], ["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 7, 8, 196, 0, 57, 15, 679, 17, 354], ["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667...
5
225
n,m,x =map(int,input().split()) a = [] c = [] for _ in range(n): a.append(list(map(int,input().split()))) c.append(a[-1].pop(0)) #print(a,c) ans = 10 ** 8 for i in range(1 << n): cost = 0 check = True d = [0 for i in range(n)] for j in range(n): if i >> j & 1: cost += c[j...
n,m,x =map(int,input().split()) a = [] c = [] for _ in range(n): a.append(list(map(int,input().split()))) c.append(a[-1].pop(0)) #print(a,c) ans = 10 ** 8 for i in range(1 << n): cost = 0 check = True d = [0 for i in range(m)] for j in range(n): if i >> j & 1: cost += c[j...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
194
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; 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.at(i); rep(j, m) { cin >> a.at(i).at(j); } } int sum = 10...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) using ll = long long; 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.at(i); rep(j, m) { cin >> a.at(i).at(j); } } int sum = 10...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
263
#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 = 1e9; 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,...
#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 = 1e9; 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,...
[["+", 0, 7, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
273
require 'matrix' n, m, x = gets.split.map(&:to_i) c = Array.new(n, 0) a = Array.new(n){Array.new(m, 0)} a = Matrix.zero(n, m) n.times do |i| b = gets.split.map(&:to_i) c[i] = b[0] 1.upto(m) do |j| a[i, j - 1] = b[j] end end m.times do |j| if a.column(j).to_a.sum < x puts "-1" exit end end #p c ...
require 'matrix' n, m, x = gets.split.map(&:to_i) c = Array.new(n, 0) a = Array.new(n){Array.new(m, 0)} a = Matrix.zero(n, m) n.times do |i| b = gets.split.map(&:to_i) c[i] = b[0] 1.upto(m) do |j| a[i, j - 1] = b[j] end end m.times do |j| if a.column(j).to_a.sum < x puts "-1" exit end end min =...
[["-", 0, 652, 196, 737, 8, 736, 0, 662, 31, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 31, 22], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 0, 32], ["+", 0, 652, 196, 737, 8, 736, 0, 662, 12, 612]]
4
238
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #include <ext/pb_ds/detail/standard_policies.hpp> // using namespace __gnu_pdbs; using namespace std; // typedef tree<int, null_type, less<int>, rb_tree_tag, // tree_order_statistics_node_update>...
#include <bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // #include <ext/pb_ds/detail/standard_policies.hpp> // using namespace __gnu_pdbs; using namespace std; // typedef tree<int, null_type, less<int>, rb_tree_tag, // tree_order_statistics_node_update>...
[["-", 0, 9, 0, 43, 49, 50, 49, 80, 81, 22], ["+", 0, 9, 0, 43, 49, 50, 49, 80, 81, 22]]
1
724
// ABC167C // https://atcoder.jp/contests/abc167/submissions/13110642 // https://www.sejuku.net/blog/48660 #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define inf 10000000001 int main() { int n, m, x, ans = inf; cin >> n >> m >> x; int c[n], a[n][m]; rep(i, n)...
// ABC167C // https://atcoder.jp/contests/abc167/submissions/13110642 // https://www.sejuku.net/blog/48660 #include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define inf 10000100 int main() { int n, m, x; int ans = inf; cin >> n >> m >> x; int c[n], a[n][m]; rep(i,...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 0, 21], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40]]
1
226
N, M, X = map(int, input().split()) C = [0] * N A = [[0 for _ in range(M)] for _ in range(N)] for i in range(N): A[i] = list(map(int, input().split())) C[i] = A[i][0] A[i] = A[i][1:] ans = sum(C) + 1 Y = [0] * M for p in range(2 ** N): for i in range(M): Y[i] = 0 cnt = 0 _p = p for i, c in enumerate(C...
N, M, X = map(int, input().split()) C = [0] * N A = [[0 for _ in range(M)] for _ in range(N)] for i in range(N): A[i] = list(map(int, input().split())) C[i] = A[i][0] A[i] = A[i][1:] ans = sum(C) + 1 Y = [0] * M for p in range(2 ** N): for i in range(M): Y[i] = 0 cnt = 0 _p = p for i, c in enumerate(C...
[["-", 0, 652, 3, 4, 0, 41, 0, 666, 667, 18], ["+", 0, 652, 3, 4, 0, 41, 0, 666, 667, 19]]
5
217
#include <bits/stdc++.h> using ll = long long int; using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> A(N, vector<int>(M + 1, 0)); for (int i = 0; i < N; i++) { for (int j = 0; j <= M; j++) { cin >> A[i][j]; } } int ans = 100000000; for (int i = 1; i < (1...
#include <bits/stdc++.h> using ll = long long int; using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> A(N, vector<int>(M + 1, 0)); for (int i = 0; i < N; i++) { for (int j = 0; j <= M; j++) { cin >> A[i][j]; } } int ans = 100000000; for (int i = 1; i < (1...
[["-", 0, 7, 15, 16, 12, 23, 0, 16, 12, 13], ["+", 0, 7, 15, 16, 12, 23, 0, 16, 12, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
1
289
n, m, x = map(int, input().split()) b = 10**18 tm = [] for i in range(m): tm.append(list(map(int, input().split()))) for i in range(2**n): c = [0 for i in range(m)] sum = 0 for j in range(n): if (i >> j) & 1: sum += tm[j][0] for k in range(m): c[k] += tm[j...
n, m, x = map(int, input().split()) b = 10**18 tm = [] for i in range(n): tm.append(list(map(int, input().split()))) for i in range(2**n): c = [0 for i in range(m)] sum = 0 for j in range(n): if (i >> j) & 1: sum += tm[j][0] for k in range(m): c[k] += tm[j...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
163