buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> typedef long long int ll; using namespace std; #define P 1000000007 #define rep(i, n) for (i = 0; i < n; ++i) #define repp(i, a, n) for (i = a; i < n; ++i) #define repr(i, a, n) for (i = a; i >= n; --i) #define pb push_back #define mp m...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <vector> typedef long long int ll; using namespace std; #define P 1000000007 #define rep(i, n) for (i = 0; i < n; ++i) #define repp(i, a, n) for (i = a; i < n; ++i) #define repr(i, a, n) for (i = a; i >= n; --i) #define pb push_back #define mp m...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
651
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n); vector<int> c(n); ll ans = (1 << 29); for (int i = 0; i < n; i++) { cin >> c.at(i); a.at(i).resize(m); for (int j = 0; j < m; j++) { cin >> a.at(i).a...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> a(n); vector<int> c(n); ll ans = (1 << 29); for (int i = 0; i < n; i++) { cin >> c.at(i); a.at(i).resize(m); for (int j = 0; j < m; j++) { cin >> a.at(i).a...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
318
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<ll>> a(n); vector<ll> c(n); ll ans = (1 << 29); for (int i = 0; i < n; i++) { cin >> c.at(i); a.at(i).resize(m); for (int j = 0; j < m; j++) { cin >> a.at(i).at(...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<ll>> a(n); vector<ll> c(n); ll ans = (1 << 29); for (int i = 0; i < n; i++) { cin >> c.at(i); a.at(i).resize(m); for (int j = 0; j < m; j++) { cin >> a.at(i).at(...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
318
(N,M,X),*A=$<.map{_1.split.map &:to_i} p (1..N).map{|n|A.combination(n).map{|e|e.transpose.drop(1).all?{X<=_1.sum}&&e.sum{_1[0]}}}.flatten.compact.min||-1
(N,M,X),*A=$<.map{_1.split.map &:to_i} p (1..N).map{|n|A.combination(n).map{|e|e.transpose.drop(1).all?{X<=_1.sum}&&e.sum{_1[0]}}}.flatten.select{_1}.min||-1
[["-", 3, 4, 0, 738, 31, 652, 486, 652, 735, 22], ["+", 3, 4, 0, 738, 31, 652, 486, 652, 735, 22], ["+", 0, 738, 31, 652, 486, 652, 196, 196, 0, 45], ["+", 31, 652, 486, 652, 196, 196, 8, 734, 0, 22], ["+", 0, 738, 31, 652, 486, 652, 196, 196, 0, 46]]
4
85
(N,M,X),*A=$<.map{|e|e.split.map &:to_i} p (1...N).map{|n|A.combination(n).select{|e|e.transpose.drop(1).all?{|e|X<=e.inject(:+)}}.map{|e|e.inject(0){|s,x|s+x[0]}}}.flatten.min||-1
(N,M,X),*A=$<.map{|e|e.split.map &:to_i} p (1..N).map{|n|A.combination(n).select{|e|e.transpose.drop(1).all?{|e|X<=e.inject(:+)}}.map{|e|e.inject(0){|s,x|s+x[0]}}}.flatten.min||-1
[["-", 486, 652, 486, 652, 486, 739, 0, 475, 17, 389], ["+", 486, 652, 486, 652, 486, 739, 0, 475, 17, 757]]
4
108
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>>...
#include <algorithm> #include <climits> #include <cmath> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <stack> #include <string> #include <unordered_map> #include <vector> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>>...
[["-", 0, 57, 64, 1, 0, 11, 12, 2, 63, 22], ["+", 0, 57, 64, 1, 0, 11, 12, 2, 63, 22]]
1
306
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define PI 3.1415926535897932384626433832795028 #define INF (1 << 29) #define LINF (1LL << 60) using namespace std; using INT = long long; using P = pair<int, int>; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> c; c.resi...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define PI 3.1415926535897932384626433832795028 #define INF (1 << 29) #define LINF (1LL << 60) using namespace std; using INT = long long; using P = pair<int, int>; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> c; c.resi...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
269
import itertools N,M,X = map(int,input().split()) A = [list(map(int,input().split())) for i in range(N)] z = [i for i in range(1, N)] m = [1000000000000000000] for i in range(N): x = list(itertools.combinations(z,i+1)) for s in x: for k in range(1,M+1): C = sum(A[j-1][k] for j in s) ...
import itertools N,M,X = map(int,input().split()) A = [list(map(int,input().split())) for i in range(N)] z = [i for i in range(1, N+1)] m = [1000000000000000000] for i in range(N): x = list(itertools.combinations(z,i+1)) for s in x: for k in range(1,M+1): C = sum(A[j-1][k] for j in s) ...
[["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
169
# frozen_string_literal: true n, m, x = gets.split.map(&:to_i) arr = [] alg = Array.new(m, 0) sum = 0 n.times do a = gets.split.map(&:to_i) (1..m).each do |i| alg[i - 1] += a[i] end sum += a[0] arr << a end unless alg.select { |i| i < x }.empty? puts -1 exit end (1..m).each do |i| arr.combination(i...
# frozen_string_literal: true n, m, x = gets.split.map(&:to_i) arr = [] alg = Array.new(m, 0) sum = 0 n.times do a = gets.split.map(&:to_i) (1..m).each do |i| alg[i - 1] += a[i] end sum += a[0] arr << a end unless alg.select { |i| i < x }.empty? puts -1 exit end (1..n).each do |i| arr.combination(i...
[["-", 0, 493, 0, 652, 486, 739, 0, 475, 444, 22], ["+", 0, 493, 0, 652, 486, 739, 0, 475, 444, 22]]
4
193
import itertools import sys n, m, x = map(int, input().split()) num = list(list(map(int, input().split())) for i in range(n)) s = [i for i in range(m)] t = [] list_num = [] for i in range(m): t.append(list(map(list, itertools.combinations(s, i + 1)))) for i in t: for j in i: k = [0] * (m + 1) for z in j...
import itertools import sys n, m, x = map(int, input().split()) num = list(list(map(int, input().split())) for i in range(n)) s = [i for i in range(n)] t = [] list_num = [] for i in range(n): t.append(list(map(list, itertools.combinations(s, i + 1)))) for i in t: for j in i: k = [0] * (m + 1) for z in ...
[["-", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
255
/** * C - Skill Up * https://atcoder.jp/contests/abc167/tasks/abc167_c */ #include <bits/stdc++.h> using namespace std; int N, M, X; vector<int> CP(14); vector<vector<int>> CA(14, vector<int>(14)); vector<bool> KAU_KAWANAI(14, false); int calcPrice() { int price = 0; for (int i = 0; i < N; i++) { if (KAU_...
/** * C - Skill Up * https://atcoder.jp/contests/abc167/tasks/abc167_c */ #include <bits/stdc++.h> using namespace std; int N, M, X; vector<int> CP(14); vector<vector<int>> CA(14, vector<int>(14)); vector<bool> KAU_KAWANAI(14, false); int calcPrice() { int price = 0; for (int i = 0; i < N; i++) { if (KAU_...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 22]]
1
353
#include <bits/stdc++.h> using namespace std; void srch(int num, vector<vector<int>> books, vector<bool> &buy, int &final_ans, int X, int N, int M) { int ans = 0; for (int i = 0; i < N; i++) { if (buy.at(i)) { ans += books.at(i).at(0); } } /* if(buy.at(1) && buy.at(2) && buy.at(3) && b...
#include <bits/stdc++.h> using namespace std; void srch(int num, vector<vector<int>> books, vector<bool> &buy, int &final_ans, int X, int N, int M) { int ans = 0; for (int i = 0; i < N; i++) { if (buy.at(i)) { ans += books.at(i).at(0); } } /* if(buy.at(1) && buy.at(2) && buy.at(3) && b...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22]]
1
496
n, m, x = list(map(int, input().split())) books = [] dp = [[0]*(m+1) for i in range(2**n)] for i in range(n): book = list(map(int, input().split())) books.append(book) min_cost = -1 for i in range(2**n): if i == 0: continue refbook = 0 keta = 0 for j in range(12): if (i >...
n, m, x = list(map(int, input().split())) books = [] dp = [[0]*(m+1) for i in range(2**(n))] for i in range(n): book = list(map(int, input().split())) books.append(book) min_cost = -1 for i in range(2**(n)): if i == 0: continue refbook = 0 keta = 0 for j in range(13): if ...
[["+", 12, 652, 3, 4, 0, 657, 12, 23, 0, 24], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 25], ["+", 12, 652, 3, 4, 0, 657, 12, 23, 0, 25], ["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 612]]
5
249
#include <bits/stdc++.h> using namespace std; typedef long long ll; int kk[20]; int n, m, x; int chec() { for (int i = 1; i <= m; i++) if (kk[i] < x) return 0; return 1; } int main() { int a[20], p[20][20]; scanf("%d%d%d", &n, &m, &x); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); f...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int kk[20]; int n, m, x; int chec() { for (int i = 1; i <= m; i++) if (kk[i] < x) return 0; return 1; } int main() { int a[20], p[20][20]; scanf("%d%d%d", &n, &m, &x); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); f...
[["-", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 57, 64, 9, 0, 7, 15, 16, 12, 22]]
1
314
#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, 0)); for (int i = 0; i < N; i++) { cin >> C.at(i); for (int j = 0; j < M; j++) cin >> A.at(i).at(j); } int ans = 20000000; for (int tmp = 0...
#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, 0)); for (int i = 0; i < N; i++) { cin >> C.at(i); for (int j = 0; j < M; j++) cin >> A.at(i).at(j); } int ans = 2000000; for (int tmp = 0;...
[["-", 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
314
import itertools import numpy as np def resolve(): N, M, X = map(int, input().split()) C = [] Q = [] for i in range(N): QQ = list(map(int, input().split())) C.append(QQ[0]) Q.append(QQ[1:]) C = np.array(C) Q = np.array(Q) ok = False NN = range(N) ans = np...
import itertools import numpy as np def resolve(): N, M, X = map(int, input().split()) C = [] Q = [] for i in range(N): QQ = list(map(int, input().split())) C.append(QQ[0]) Q.append(QQ[1:]) C = np.array(C) Q = np.array(Q) ok = False NN = range(N) ans = np...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
223
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> inline bool chmin(T &x, U y) { if (x > y) { x = y; return true; } return false; } template <class T, class U> inline bool chmax(T &x, U y) { if (x < y) { x = y; return true; } return false; } #def...
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class T, class U> inline bool chmin(T &x, U y) { if (x > y) { x = y; return true; } return false; } template <class T, class U> inline bool chmax(T &x, U y) { if (x < y) { x = y; return true; } return false; } #def...
[["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 24], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 31, 13], ["-", 0, 7, 15, 16, 12, 23, 0, 16, 17, 151], ["-", 8, 9, 0, 7, 15, 16, 12, 23, 0, 25], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
377
#include <iostream> #include <string> // data structure #include <deque> #include <map> #include <set> #include <stack> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main(int argc, char const *argv[]) { long long int n, m, x; cin >> n >> m >> x; std::vector<std::vector<long...
#include <iostream> #include <string> // data structure #include <deque> #include <map> #include <set> #include <stack> #include <vector> #include <algorithm> #include <cmath> using namespace std; int main(int argc, char const *argv[]) { long long int n, m, x; cin >> n >> m >> x; std::vector<std::vector<long...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13], ["+", 64, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
312
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define rep2(i, n) for (int i = 0; i <= n; i++) #define repr(i, a, n) for (int i = a; i < n; i++) #define all(a) a.begin(), a.end() #define P pair<long long, ...
#include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) #define rep1(i, n) for (int i = 1; i <= n; i++) #define rep2(i, n) for (int i = 0; i <= n; i++) #define repr(i, a, n) for (int i = a; i < n; i++) #define all(a) a.begin(), a.end() #define P pair<long long, ...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
421
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { unsigned long n, m, x; unsigned long score[12] = {0}; int book[12] = {0}, ibook[12]; unsigned long cost[12], a[12][12]; int i, j; unsigned long sum_cost = 0, sum_score = 0, ans = 0, max; int flg_break; scanf(...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { unsigned long n, m, x; unsigned long score[12] = {0}; int book[12] = {0}, ibook[12]; unsigned long cost[12], a[12][12]; int i, j; unsigned long sum_cost = 0, sum_score = 0, ans = 0, max; int flg_break; scanf(...
[["-", 0, 7, 8, 9, 0, 57, 64, 93, 0, 94], ["+", 0, 7, 8, 9, 0, 57, 64, 116, 0, 117]]
0
677
import itertools N,M,X=map(int,input().split(' ')) book=[] skil=[0]*M for i in range(N): line=list(map(int,input().split(' '))) book.append(line) skil=list(map(lambda x,y:x+y,skil,line[1:])) min_p=100000 for n in range(1,N+1): for conbo in itertools.combinations(book,n): conbo_book=[0]*(1+M) ...
import itertools N,M,X=map(int,input().split(' ')) book=[] skil=[0]*M for i in range(N): line=list(map(int,input().split(' '))) book.append(line) skil=list(map(lambda x,y:x+y,skil,line[1:])) min_p=12000000 for n in range(1,N+1): for conbo in itertools.combinations(book,n): conbo_book=[0]*(1+M...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 656, 0, 1, 0, 41, 0, 666, 0, 612], ["+", 0, 656, 0, 1, 0, 41, 0, 666, 0, 612]]
5
209
import itertools fi = list(map(int,input().split())) n = fi[0] m = fi[1] x = fi[2] c = [] cn = [] y = 1 for k in range(n): cn.append(k) for i in range(n): a = list(map(int,input().split())) c.append(a) for j in range(m): wa = 0 for s in range(n): wa=wa+c[s][j+1] if wa <= x: y=y*0 money = [] if not ...
import itertools fi = list(map(int,input().split())) n = fi[0] m = fi[1] x = fi[2] c = [] cn = [] y = 1 for k in range(n): cn.append(k) for i in range(n): a = list(map(int,input().split())) c.append(a) for j in range(m): wa = 0 for s in range(n): wa=wa+c[s][j+1] if wa < x: y=y*0 money = [] if not y...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
297
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long int #define ld long double #define MAX 200007 #define MOD 1000000007 #define fast \ ios::sync_with_stdio(0); \ ...
#include <bits/stdc++.h> #include <iostream> using namespace std; #define ll long long int #define ld long double #define MAX 100000000007 #define MOD 1000000007 #define fast \ ios::sync_with_stdio(0); ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59]]
1
432
import itertools n, m, x = map(int, input().split()) a = [0] * n arr = [] ans = 10000 for i in range(n): a[i] = list(map(int, input().split())) for i in range(1, n+1): for j in itertools.combinations(range(n), i): b = [0] * m c = 0 for k in list(j): for l in range(m): ...
import itertools n, m, x = map(int, input().split()) a = [0] * n ans = 100000000 for i in range(n): a[i] = list(map(int, input().split())) for i in range(1, n+1): for j in itertools.combinations(range(n), i): b = [0] * m c = 0 for k in list(j): for l in range(m): ...
[["-", 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, 634, 0, 70], ["-", 0, 656, 0, 1, 0, 662, 12, 634, 0, 73], ["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], [...
5
176
import sys n, m, x = map(int, input().split()) MAX = sys.maxsize datas = [] for i in range(n): datas.append(list(map(int, input().split()))) kingaku = 0 memos = [[0] * (m+2) for _ in range(n)] def rec(i, rikaido, kingaku): # print('i, rikaido, kingaku', i, rikaido, kingaku) # print('終了条件', [i >= x ...
import sys n, m, x = map(int, input().split()) MAX = sys.maxsize datas = [] for i in range(n): datas.append(list(map(int, input().split()))) kingaku = 0 memos = [[0] * (m+2) for _ in range(n)] def rec(i, rikaido, kingaku): #print('i, rikaido, kingaku', i, rikaido, kingaku) #print('終了条件', [i >= x fo...
[["-", 0, 662, 12, 652, 3, 4, 0, 664, 17, 33], ["-", 0, 662, 12, 652, 3, 4, 0, 664, 28, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612]]
5
203
import itertools n,m,x=map(int,input().split()) l=[[0]]*n ln=[0]*m kan=0 for i in range(n): l[i]=list(map(int,input().split())) for j in range(m+1): if j==0: kan+=l[i][j] else: ln[j-1]+=l[i][j] if sorted(ln)[0]<x: print(-1) else: mkan=-1 for i in range(n): itr=itertools.combinations(ra...
import itertools n,m,x=map(int,input().split()) l=[[0]]*n ln=[0]*m kan=0 for i in range(n): l[i]=list(map(int,input().split())) for j in range(m+1): if j==0: kan+=l[i][j] else: ln[j-1]+=l[i][j] if sorted(ln)[0]<x: print(-1) else: mkan=-1 for i in range(n+1): itr=itertools.combinations(...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 206, 612], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73]]
5
232
import itertools N,M,X = map(int, input().split()) S = [] N_list = list(range(1,N+1)) for _ in range(N): c = list(map(int, input().split())) S.append(c) min = 100000 for i in range(1,N+1): c = list(itertools.combinations(N_list, i)) for v in c: A = [0]*M money = 0 flag =0 ...
import itertools N,M,X = map(int, input().split()) S = [] N_list = list(range(1,N+1)) for _ in range(N): c = list(map(int, input().split())) S.append(c) min = 1200001 for i in range(1,N+1): c = list(itertools.combinations(N_list, i)) for v in c: A = [0]*M money = 0 flag =0 ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 79], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]...
5
207
import itertools import numpy as np n, m, x= map(int, input().split()) a = [input().split() for l in range(n)] npa=np.array(a, dtype=int) hon=-1 for i in range(1,n+1): base = list(itertools.combinations(range(0,n),i)) # print (base) for j in base: totalv=np.sum(npa[j,], axis=0) # print (totalv, min(tot...
import itertools import numpy as np n, m, x= map(int, input().split()) a = [input().split() for l in range(n)] npa=np.array(a, dtype=int) hon=-1 for i in range(1,n+1): base = list(itertools.combinations(range(0,n),i)) # print (base) for j in base: totalv=np.sum(npa[j,], axis=0) # print (totalv, min(tot...
[["-", 3, 4, 0, 206, 206, 663, 0, 664, 17, 33], ["+", 3, 4, 0, 206, 206, 663, 0, 657, 31, 22], ["+", 3, 4, 0, 206, 206, 663, 0, 657, 17, 72]]
5
162
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> book(N, vector<int>(M + 1)); for (int i = 0; i < N; i++) { for (int j = 0; j < M + 1; j++) { cin >> book.at(i).at(j); } } bool kaiaru = false; int kai = 0; for (int tmp = 0; t...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> book(N, vector<int>(M + 1)); for (int i = 0; i < N; i++) { for (int j = 0; j < M + 1; j++) { cin >> book.at(i).at(j); } } bool kaiaru = false; int kai = INT_MAX; for (int tmp ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13]]
1
297
// Hey u r far away to know this #include <bits/stdc++.h> using namespace std; #define ff first #define pb push_back #define ss second #define ll long long #define MAX 5000 #define mpi map<int, int> #define mpll map<ll, ll> #define pll pair<ll, ll> #define plld pair<ll, double> #define SKILLER ...
// Hey u r far away to know this #include <bits/stdc++.h> using namespace std; #define ff first #define pb push_back #define ss second #define ll long long #define MAX 5000 #define mpi map<int, int> #define mpll map<ll, ll> #define pll pair<ll, ll> #define plld pair<ll, double> #define SKILLER ...
[["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
414
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): N, M, X = read_ints() A = [] for _ in range(N): A.append(read_ints()) min_T = math.inf for S in range(1, (1<<N)): T = [0]*M f...
import math def read_int(): return int(input().strip()) def read_ints(): return list(map(int, input().strip().split(' '))) def solve(): N, M, X = read_ints() A = [] for _ in range(N): A.append(read_ints()) min_T = math.inf for S in range(1, (1<<N)): T = [0]*(M+1) ...
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
201
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1000000007 using namespace std; int n, m, x; int flag[12]; int c[12]; int a[12][12]; int min1 = INF; void rec(int i) { if (i == n) { int sum = 0; int aa[12]; rep(i, n) aa[i] = 0; rep(i, n) { if (flag[i] == 1) { ...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; i++) #define INF 1000000007 using namespace std; int n, m, x; int flag[12]; int c[12]; int a[12][12]; int min1 = INF; void rec(int i) { if (i == n) { int sum = 0; int aa[12]; rep(i, m) aa[i] = 0; rep(i, n) { if (flag[i] == 1) { ...
[["-", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["+", 0, 11, 31, 69, 28, 2, 3, 4, 0, 22], ["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
282
#include <bits/stdc++.h> using namespace std; using ll = long long; int n, m, x; bool good(vector<int> &b) { for (int i : b) { if (i < x) { return false; } } return true; } void solve() { cin >> n >> m >> x; vector<vector<int>> v(n, vector<int>(m + 1)); for (int i = 0; i < n; i++) { for...
#include <bits/stdc++.h> using namespace std; using ll = long long; int n, m, x; bool good(vector<int> &b) { for (int i : b) { if (i < x) { return false; } } return true; } void solve() { cin >> n >> m >> x; vector<vector<int>> v(n, vector<int>(m + 1)); for (int i = 0; i < n; i++) { for...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]]
1
322
#include <stdio.h> //累乗(power)a^n(mod10^9+7) long long power(long long a, long long n) { long long count = a, sum = 1; while (n > 0) { if (n % 2 == 1) sum *= count; count *= count; count %= 1000000007; sum %= 1000000007; n /= 2; } return sum; } int main() { int n, m, x, min = 200000...
#include <stdio.h> //累乗(power)a^n(mod10^9+7) long long power(long long a, long long n) { long long count = a, sum = 1; while (n > 0) { if (n % 2 == 1) sum *= count; count *= count; count %= 1000000007; sum %= 1000000007; n /= 2; } return sum; } int main() { int n, m, x, min = 200000...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
0
379
n=gets.split.map(&:to_i) lines = [] while line=gets lines << line.chomp.split(' ').map(&:to_i) end result=[1000000000] for i in 1..lines.length combi=lines.combination(i).to_a for j in 0..combi.length-1 yen=0 v=Array.new(n[1],0) combi[j].each do |k| yen+...
n=gets.split.map(&:to_i) lines = [] while line=gets lines << line.chomp.split(' ').map(&:to_i) end result=[10000000000] for i in 1..lines.length combi=lines.combination(i).to_a for j in 0..combi.length-1 yen=0 v=Array.new(n[1],0) combi[j].each do |k| yen...
[["-", 36, 36, 0, 493, 0, 662, 12, 516, 0, 612], ["+", 36, 36, 0, 493, 0, 662, 12, 516, 0, 612]]
4
167
from itertools import combinations N,M,X = map(int,input().split()) all_text = [list(map(int,input().split())) for i in range(N)] array = [i for i in range(N)] comb = [] for i in range(N-1): r = list(map(list,list(combinations(array,i+1)))) comb.extend(r) ans = [] for i in comb: check = [0 for i in ra...
from itertools import combinations N,M,X = map(int,input().split()) all_text = [list(map(int,input().split())) for i in range(N)] array = [i for i in range(N)] comb = [] for i in range(N): r = list(map(list,list(combinations(array,i+1)))) comb.extend(r) ans = [] for i in comb: check = [0 for i in rang...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
228
import numpy as np n,m,x = map(int,input().split()) l = [] for i in range(n): l.append(np.array(input().split(),dtype=int)) import itertools num = [i for i in range(n)] min = 1000000000000000000000000 k = 1 while k <n+1: a = list(itertools.combinations(num, k)) for i in range(len(a)): total =np.zer...
import numpy as np n,m,x = map(int,input().split()) l = [] for i in range(n): l.append(np.array(input().split(),dtype=int)) import itertools num = [i for i in range(n)] min = 1000000000000000000000000 k = 1 while k <n+1: a = list(itertools.combinations(num, k)) for i in range(len(a)): total =np.zer...
[["-", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 31, 22], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 17, 72], ["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 612], ["-", 0, 52, 8, 196, 0, 1, 0, 677, 31, 22]]
5
204
import itertools import numpy as np N, M, X = map(int, input().split()) lis_all = [list(map(int, input().split())) for _ in range(N)] lis_C = np.array(list(map(lambda x: x[0], lis_all))) lis_A = np.array(list(map(lambda x: x[1:], lis_all))) row_idx = [] bools = [True,False] for boollis in itertools.product(bools, re...
import itertools import numpy as np N, M, X = map(int, input().split()) lis_all = [list(map(int, input().split())) for _ in range(N)] lis_C = np.array(list(map(lambda x: x[0], lis_all))) lis_A = np.array(list(map(lambda x: x[1:], lis_all))) row_idx = [] bools = [True,False] for boollis in itertools.product(bools, re...
[["-", 0, 7, 12, 652, 3, 4, 0, 653, 51, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 653, 51, 22], ["-", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 22], ["-", 0, 652, 63, 319, 500, 206, 206, 206, 206, 612], ["+", 0, 652, 63, 319, 500, 206, 206, 206, 206, 22]]
5
210
#include <bits/stdc++.h> using namespace std; #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); typedef long...
#include <bits/stdc++.h> using namespace std; #define fastIO \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); \ cout.tie(NULL); typedef long...
[["-", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46], ["+", 0, 57, 64, 9, 0, 57, 64, 9, 0, 46]]
1
400
import itertools n, m, x = map(int, input().split()) C = [] A = [] for _ in range(n): a = list(map(int, input().split())) C.append(a[0]) A.append(a[1:]) ans = [] for i in range(n): for combination in list(itertools.combinations(range(n), i)): #print(combination) total = 0 li =...
import itertools n, m, x = map(int, input().split()) C = [] A = [] for _ in range(n): a = list(map(int, input().split())) C.append(a[0]) A.append(a[1:]) ans = [] for i in range(n): for combination in list(itertools.combinations(range(n), i+1)): # print(combination) total = 0 l...
[["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
197
import itertools n,m,x=map(int,input().split()) ca=[0]*n num=[] ls=[] last=[] test=0 ng=0 money=0 for i in range(n): ca[i]=input().split() num.append(i) for j in range(1,n+1): ls=list(itertools.combinations(num,j)) for k in range(len(ls)): test=0 money=0 ng=0 for l in range(m): for ...
import itertools n,m,x=map(int,input().split()) ca=[0]*n num=[] ls=[] last=[] test=0 ng=0 money=0 for i in range(n): ca[i]=input().split() num.append(i) for j in range(1,n+1): ls=list(itertools.combinations(num,j)) for k in range(len(ls)): test=0 money=0 ng=0 for l in range(m): test...
[["+", 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]]
5
226
#!/usr/bin/env python3 import sys import pprint import itertools sys.setrecursionlimit(10 ** 6) class Logger: def __init__(self, debug): self.debug = debug def print(self, *args): if self.debug: pprint.pprint(args) def main(): log = Logger(1) n, m, x = map(int, sys.stdin.readline().split()) c = [] a ...
#!/usr/bin/env python3 import sys import pprint import itertools sys.setrecursionlimit(10 ** 6) class Logger: def __init__(self, debug): self.debug = debug def print(self, *args): if self.debug: pprint.pprint(args) def main(): log = Logger(0) n, m, x = map(int, sys.stdin.readline().split()) c = [] a ...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 612]]
5
280
import itertools import numpy N, M, X = list(map(int, input().split())) price = [] tmp = [] for i in range(N): _ = list(map(int, input().split())) price.append(_[0]) tmp.extend(_[1:]) price = numpy.array(price) learn = numpy.array(tmp).reshape((N, M)) if min(numpy.sum(learn, axis=0)) < X: print(-1) else: ...
import itertools import numpy N, M, X = list(map(int, input().split())) price = [] tmp = [] for i in range(N): _ = list(map(int, input().split())) price.append(_[0]) tmp.extend(_[1:]) price = numpy.array(price) learn = numpy.array(tmp).reshape((N, M)) if min(numpy.sum(learn, axis=0)) < X: print(-1) else: ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
224
#include <algorithm> #include <iostream> #include <map> #include <string> #include <tuple> #include <vector> using namespace std; // const int mymax = 2147483647; const long mymax = 9223372036854775807; // int sol = mymax; long judge(vector<long> C, int X, vector<vector<long>> A, vector<int> buff, int bR)...
#include <algorithm> #include <iostream> #include <map> #include <string> #include <tuple> #include <vector> using namespace std; // const int mymax = 2147483647; const long mymax = 9223372036854775807; // int sol = mymax; long judge(vector<long> C, int X, vector<vector<long>> A, vector<int> buff, int bR)...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
609
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> A(N, vector<int>(M)); vector<int> MAX(M, 0); 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 = 200000...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> A(N, vector<int>(M)); vector<int> MAX(M, 0); 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 = 200000...
[["-", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13], ["+", 8, 9, 0, 43, 39, 344, 3, 347, 0, 13]]
1
303
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int64_t> c(n); vector<vector<int>> a(n, vector<int>(m, 0)); int64_t ans = 100002; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (int...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n); vector<vector<int>> a(n, vector<int>(m, 0)); int64_t ans = 100002000; for (int i = 0; i < n; i++) { cin >> c[i]; for (int j = 0; j < m; j++) { cin >> a[i][j]; } } for (int ...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["-", 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
284
N,M,X=map(int,input().split()) cost=[0]*N A=[] for i in range(N): CA=list(map(int,input().split())) cost[i]=CA[0] A.append(CA[1:]) ans=float("inf") for i in range(N**2): a=[0]*M checked=[0]*M money=0 cnt=0 for j in range(N): if i%2==1: for k in range(M): ...
N,M,X=map(int,input().split()) cost=[0]*N A=[] for i in range(N): CA=list(map(int,input().split())) cost[i]=CA[0] A.append(CA[1:]) ans=float("inf") for i in range(2**N): a=[0]*M checked=[0]*M money=0 cnt=0 for j in range(N): if i%2==1: for k in range(M): ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 578], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 22]]
5
214
from itertools import combinations def skill(m, l, x): ans = pow(10, 9) rikai = [0 for _ in range(m)] for i in range(m): cl = combinations(range(n), i+1) for c in cl: cost = 0 rikai = [0 for _ in range(m)] for j in c: cost += l[j][0] ...
from itertools import combinations def skill(m, l, x): ans = pow(10, 9) rikai = [0 for _ in range(m)] for i in range(n): cl = combinations(range(n), i+1) for c in cl: cost = 0 rikai = [0 for _ in range(m)] for j in c: cost += l[j][0] ...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
231
import sys import numpy as np from itertools import combinations sys.setrecursionlimit(10 ** 6) # 再帰関数の再帰の深さを設定 to_index = lambda x: int(x) - 1 # 入力した数字に1を引いたものを返す print_list_in_2D = lambda x: print(*x, sep="\n") # リストの要素を改行を挟んで表示する関数 # 入力を整数に変換して受け取る def input_int(): return int(input()) def map_int_input(): ...
import sys import numpy as np from itertools import combinations sys.setrecursionlimit(10 ** 6) # 再帰関数の再帰の深さを設定 to_index = lambda x: int(x) - 1 # 入力した数字に1を引いたものを返す print_list_in_2D = lambda x: print(*x, sep="\n") # リストの要素を改行を挟んで表示する関数 # 入力を整数に変換して受け取る def input_int(): return int(input()) def map_int_input(): ...
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22]]
5
344
import numpy as np N,M,X=map(int,input().split()) CA=[] for i in range(N): CA.append(list(map(int,input().split()))) #print(CA) m=[i+1 for i in range(N)] from itertools import combinations minmoney=float('inf') for k in range(M): for i in combinations(m,k+1): #print(i) money=0 r=[0]*M fo...
import numpy as np N,M,X=map(int,input().split()) CA=[] for i in range(N): CA.append(list(map(int,input().split()))) #print(CA) m=[i+1 for i in range(N)] from itertools import combinations minmoney=float('inf') for k in range(N): for i in combinations(m,k+1): #print(i) money=0 r=[0]*M fo...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
214
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define REP(i, n) for (i = 0; i < n; i++) #define MAX 1000000 #define MOD 1000000007 long long fac[MAX], finv[MAX], inv[MAX]; // prototype declaration int i_in(); long long ll_in(); double d_in(); char c_in(); void s_in...
#include <limits.h> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define REP(i, n) for (i = 0; i < n; i++) #define MAX 1000000 #define MOD 1000000007 long long fac[MAX], finv[MAX], inv[MAX]; // prototype declaration int i_in(); long long ll_in(); double d_in(); char c_in(); void s_in...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
0
3,248
#include <algorithm> #include <climits> #include <iostream> #include <string> #include <vector> using std::cin; using std::cout; using std::string; using std::vector; using ull = unsigned long long; using ll = long long; int main() { ull n, m, x; cin >> n >> m >> x; vector<ull> c(n); vector<vector<ull>> a(n);...
#include <algorithm> #include <climits> #include <iostream> #include <string> #include <vector> using std::cin; using std::cout; using std::string; using std::vector; using ull = unsigned long long; using ll = long long; int main() { ull n, m, x; cin >> n >> m >> x; vector<ull> c(n); vector<vector<ull>> a(n);...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
379
from itertools import combinations n , m ,x = map(int , input().split()) arr = [list(map(int , input().split())) for i in range(n)] ans = 10**10 for i in range(1,n): for k in combinations(arr , i): #print(k,i,n) a = [0]*m #print(k) f = 1 cost = 0 for ele in k: #print(ele) cost += ele[0] for e in r...
from itertools import combinations n , m ,x = map(int , input().split()) arr = [list(map(int , input().split())) for i in range(n)] ans = 10**10 for i in range(1,n+1): for k in combinations(arr , i): #print(k,i,n) a = [0]*m #print(k) f = 1 cost = 0 for ele in k: #print(ele) cost += ele[0] for e in...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
161
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> vec(n, vector<int>(m + 1)); for (int i = 0; i < n; i++) { for (int j = 0; j < m + 1; j++) { cin >> vec.at(i).at(j); } } int ans = 10000000; for (int bit = 0; bit < (1 << n); bit++...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x; cin >> n >> m >> x; vector<vector<int>> vec(n, vector<int>(m + 1)); for (int i = 0; i < n; i++) { for (int j = 0; j < m + 1; j++) { cin >> vec.at(i).at(j); } } int ans = 10000000; for (int bit = 0; bit < (1 << n); bit++...
[["+", 64, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 64, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
325
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #define ll long long int #define all(x) x.begin(), x.end() #define MOD 998244353 using namespace std; vector<...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> #define ll long long int #define all(x) x.begin(), x.end() #define MOD 998244353 using namespace std; vector<...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
654
n,m,x = map(int, input().split()) data_list = [] for i in range(n): data_list.append(list(map(int, input().split()))) base = 10000000 price = 12000000 for i in range(2 ** n): value_list = [0]*(m+1) value = [] for j in range(n): # このループが一番のポイント if ((i >> j) & 1): # 順に右にシフトさせ最下位bitのチェックを行う...
n,m,x = map(int, input().split()) data_list = [] for i in range(n): data_list.append(list(map(int, input().split()))) price = 12000000 for i in range(2 ** n): value_list = [0]*(m+1) value = [] for j in range(n): # このループが一番のポイント if ((i >> j) & 1): # 順に右にシフトさせ最下位bitのチェックを行う val...
[["-", 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, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["-", 3, 4, 0, 206, 206, 663, 0, 664, 17, 33], ["+", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102]]
5
186
#include <bits/stdc++.h> using namespace std; int main() { int N, M, X, count, counter2 = 0; cin >> N >> M >> X; int c[N] = {0}; int a[N][M] = {{0}}; int d[N] = {0}; int answer[M] = {0}; set<int> S; 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> using namespace std; int main() { int N, M, X, count, counter2 = 0; cin >> N >> M >> X; int c[N] = {0}; int a[N][M] = {{0}}; int d[N] = {0}; int answer[M] = {0}; set<int> S; for (int i = 0; i < N; i++) { cin >> c[i]; for (int j = 0; j < M; j++) { cin >> a[i][j]; ...
[["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 104], ["-", 0, 57, 15, 339, 51, 16, 12, 103, 0, 125], ["-", 15, 339, 51, 16, 12, 103, 0, 42, 0, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
391
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<long long> vll; typedef pair<int, int> pii; typedef vector<pii> vii; #define ll long long #define ff first #define ss second #define pb push_back #define mkp make_pair #define sz size() #define forf(a, b, c) for (int i = a; i <= b; i...
#include <bits/stdc++.h> using namespace std; typedef vector<int> vi; typedef vector<long long> vll; typedef pair<int, int> pii; typedef vector<pii> vii; #define ll long long #define ff first #define ss second #define pb push_back #define mkp make_pair #define sz size() #define forf(a, b, c) for (int i = a; i <= b; i...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 14, 8, 9, 0, 57, 15, 339, 51, 22], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 17, 111], ["+", 8, 9, 0, 57, 15, 339, 51, 91, 28, 22]]
1
525
n, m, x = map(int, input().split()) book = [] for i in range(n): book.append(list(map(int, input().split()))) min_cost = 10**8 for i in range(2**n): a = [0] * m cost = 0 for j in range(n): if (i >> j) & 1: cost += book[j][0] for k in range(m): a[k] += b...
n, m, x = map(int, input().split()) book = [] for i in range(n): book.append(list(map(int, input().split()))) min_cost = 10**8 for i in range(2**n): a = [0] * m cost = 0 for j in range(n): if (i >> j) & 1: cost += book[j][0] for k in range(m): a[k] += b...
[["-", 0, 1, 0, 677, 12, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72]]
5
175
import numpy as np from itertools import combinations n, m , x = map(int, input().split()) skill_dic = {} for i in range(n): tmp = list(map(int, input().split())) skill_dic[i] = {'cost':tmp[0],'skills':tmp[1:]} def calc_cost(skill_books, skill_dic,x): skill_nums = len(skill_dic[0]['skills']) skills = ...
import numpy as np from itertools import combinations n, m , x = map(int, input().split()) skill_dic = {} for i in range(n): tmp = list(map(int, input().split())) skill_dic[i] = {'cost':tmp[0],'skills':tmp[1:]} def calc_cost(skill_books, skill_dic,x): skill_nums = len(skill_dic[0]['skills']) skills = ...
[["-", 36, 36, 0, 656, 0, 52, 15, 666, 667, 18], ["+", 36, 36, 0, 656, 0, 52, 15, 666, 667, 19]]
5
249
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) bool hantei(int m, int x, vector<int> rikaido) { rep(i, m) { if (rikaido[i] < x) return false; } return t...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <numeric> #include <string> #include <vector> using namespace std; #define rep(i, n) for (int i = 0; i < (n); i++) bool hantei(int m, int x, vector<int> rikaido) { rep(i, m) { if (rikaido[i] < x) return false; } return t...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 12, 22], ["-", 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
429
from itertools import product n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(n)] minimum_cost = float('inf') buy_selections = product([1, 0], repeat=n) for selection in buy_selections: bought_books = [books[i] for i in range(n) if selection[i]] total_each = [...
from itertools import product n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for _ in range(n)] minimum_cost = float('inf') buy_selections = product([1, 0], repeat=n) for selection in buy_selections: bought_books = [books[i] for i in range(n) if selection[i]] total_each = [...
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
179
import numpy as np n, m, x = list(map(int, input().split())) a = [list(map(int,input().split())) for l in range(n)] x_list = [x]*m s = range(2**n) ans = 10**5 count = 0 for i in s: y = np.zeros(m+1) for j in range(n): if ((i>>j)&1): y = y+np.array(a[j]) if np.all(np.array(y[1:])>=np.arr...
import numpy as np n, m, x = list(map(int, input().split())) a = [list(map(int,input().split())) for l in range(n)] x_list = [x]*m s = range(2**n) ans = 10**10 count = 0 for i in s: y = np.zeros(m+1) for j in range(n): if ((i>>j)&1): y = y+np.array(a[j]) if np.all(np.array(y[1:])>=...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
178
import itertools N,M,X=map(int,input().split()) Money=0 lst=range(N) combs = [] for i in range(1, len(lst)+1): els = [list(x) for x in itertools.combinations(lst, i)] combs.extend(els) inList=[] for i in range(N): inList.append(list(map(int,input().split()))) Tmp=[0]*(len(combs)) for i in range(len(...
import itertools N,M,X=map(int,input().split()) Money=0 lst=range(N) combs = [] for i in range(1, len(lst)+1): els = [list(x) for x in itertools.combinations(lst, i)] combs.extend(els) inList=[] for i in range(N): inList.append(list(map(int,input().split()))) Tmp=[0]*(len(combs)) for i in range(len(...
[["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612]]
5
254
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; #define endl "\n" #define sp " " #define M 1000000007 #define PI acos(-1.0) #define pb push_back #define mp make_pair #define ff first #d...
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vector<int>> vvi; typedef vector<ll> vl; typedef vector<vector<ll>> vvl; #define endl "\n" #define sp " " #define M 1000000007 #define PI acos(-1.0) #define pb push_back #define mp make_pair #define ff first #d...
[["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 24], ["-", 0, 43, 49, 50, 51, 16, 31, 23, 0, 25], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["-", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
474
import sys import numpy as np if sys.platform =='ios': sys.stdin=open('input_file.txt') read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n,m,x=map(int,readline().split()) lst=[] cnt=0 ans=100000000 for _ in range(n): a=list(map(int,readline().split()))...
import sys import numpy as np if sys.platform =='ios': sys.stdin=open('input_file.txt') read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines n,m,x=map(int,readline().split()) lst=[] cnt=0 ans=100000000 for _ in range(n): a=list(map(int,readline().split()))...
[["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 22]]
5
236
import itertools n, m, x = map(int, input().split()) c = [list(map(int, input().split())) for i in range(n)] comb = [] for i in range(1, n+1): comb.append(list(itertools.combinations(c, i))) ans = [] for i in range(len(comb)): for j in range(len(comb[i])): flag = True for l in range(1, m): ...
import itertools n, m, x = map(int, input().split()) c = [list(map(int, input().split())) for i in range(n)] comb = [] for i in range(1, n+1): comb.append(list(itertools.combinations(c, i))) ans = [] for i in range(len(comb)): for j in range(len(comb[i])): flag = True for l in range(1, m+1): ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
225
#include <cmath> #include <iostream> #include <vector> using std::cin; using std::cout; using std::endl; using std::vector; int main() { int N, M, X; cin >> N >> M >> X; std::vector<vector<int>> text_list; std::vector<int> price_list; int32_t ans = INT32_MAX; for (int i = 0; i < N; i++) { int price;...
#include <cmath> #include <iostream> #include <vector> using std::cin; using std::cout; using std::endl; using std::vector; int main() { int N, M, X; cin >> N >> M >> X; std::vector<vector<int>> text_list; std::vector<int> price_list; int32_t ans = INT32_MAX; for (int i = 0; i < N; i++) { int price;...
[["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22], ["-", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 21], ["+", 0, 43, 49, 50, 51, 2, 3, 4, 0, 22]]
1
341
N, M, X = map(int, input().split()) S = [] for i in range(N): S.append(list(map(int, input().split()))) lst = [] for i in range(2**N): lst.append(str(bin(i))) lst[i] = lst[i][2:] lst[i] = lst[i].zfill(N) lst_res = [] for j in lst: res = [0]*(M+1) for k in range(N): if j[k] == "0": ...
N, M, X = map(int, input().split()) S = [] for i in range(N): S.append(list(map(int, input().split()))) lst = [] for i in range(2**N): lst.append(str(bin(i))) lst[i] = lst[i][2:] lst[i] = lst[i].zfill(N) lst_res = [] for j in lst: res = [0]*(M+1) for k in range(N): if j[k] == "0": ...
[["-", 0, 57, 75, 76, 8, 196, 0, 674, 0, 675]]
5
220
#include "bits/stdc++.h" using namespace std; typedef long long ll; ll n, m, x, answer = LLONG_MAX, c[13] = {}, a[13][13] = {}; void BuyBooks(ll buyBookNumber, ll paidYen, vector<ll> understandingSums) { paidYen += c[buyBookNumber]; for (ll i = 1; i <= m; i++) { understandingSums[i] += a[buyBookNumber][i]; } ...
#include "bits/stdc++.h" using namespace std; typedef long long ll; ll n, m, x, answer = LLONG_MAX, c[13] = {}, a[13][13] = {}; void BuyBook(ll buyBookNumber, ll paidYen, vector<ll> understandingSums) { paidYen += c[buyBookNumber]; for (ll i = 1; i <= m; i++) { understandingSums[i] += a[buyBookNumber][i]; } ...
[["-", 36, 36, 0, 30, 0, 14, 49, 53, 49, 22], ["+", 36, 36, 0, 30, 0, 14, 49, 53, 49, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 2, 63, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["-", 0, 7, 8, 9, 0, 1, 0, 2, 63, 22], ["+", 0, 7, 8, 9, ...
1
353
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; namespace basic { using ll = long long int; #define imax INT_MAX #define lmax LLONG_MAX #define pb push_back #define ld long double #define pii pair<int, int> #define ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; namespace basic { using ll = long long int; #define imax INT_MAX #define lmax LLONG_MAX #define pb push_back #define ld long double #define pii pair<int, int> #define ...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 22], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 17, 33], ["-", 0, 11, 12, 69, 341, 342, 0, 16, 12, 13]]
1
1,499
#include <bits/stdc++.h> using namespace std; bool chk(vector<long long> calc, long long score) { bool bol = true; for (int i = 0; i < calc.size(); i++) { if (calc.at(i) < score) { bol = false; } } return bol; } int main() { long long N, M, X; cin >> N >> M >> X; vector<long long> calc(M);...
#include <bits/stdc++.h> using namespace std; bool chk(vector<long long> calc, long long score) { bool bol = true; for (int i = 0; i < calc.size(); i++) { if (calc.at(i) < score) { bol = false; } } return bol; } int main() { long long N, M, X; cin >> N >> M >> X; vector<long long> calc(M);...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 21], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
349
#from collections import defaultdict, deque import itertools import numpy as np def main(): N, M, X = tuple(int(c) for c in input().split(' ')) C = [] A = [] for _ in range(N): tmp = tuple(int(c) for c in input().split(' ')) C.append(tmp[0]) A.append(np.array(tmp[1:])) # ma...
#from collections import defaultdict, deque import itertools import numpy as np def main(): N, M, X = tuple(int(c) for c in input().split(' ')) C = [] A = [] for _ in range(N): tmp = tuple(int(c) for c in input().split(' ')) C.append(tmp[0]) A.append(np.array(tmp[1:])) # ma...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
204
#include <bits/stdc++.h> #define ll long long #define fast_i_o \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); using namespace std; int main() { int n, m, x; cin >> n >> m >> x; int arr[n], arr1[n][m]...
#include <bits/stdc++.h> #define ll long long #define fast_i_o \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); using namespace std; int main() { ll n, m, x; cin >> n >> m >> x; ll arr[n], arr1[n][m]; ...
[["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18]]
1
279
/** * @copyright (c) 2020 Daisuke Hashimoto */ #include <bits/stdc++.h> using namespace std; using ll = int64_t; using Pair = pair<int32_t, int32_t>; int32_t N, M, X; int32_t book_cost[12]; int32_t A[12][12]; int32_t minimum_cost; int32_t look_up[1 << 11]; int32_t Decode(const int32_t tried_book, vector<bool> bo...
/** * @copyright (c) 2020 Daisuke Hashimoto */ #include <bits/stdc++.h> using namespace std; using ll = int64_t; using Pair = pair<int32_t, int32_t>; int32_t N, M, X; int32_t book_cost[12]; int32_t A[12][12]; int32_t minimum_cost; int32_t look_up[1 << 13]; int32_t Decode(const int32_t tried_book, vector<bool> bo...
[["-", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13], ["+", 0, 30, 0, 43, 49, 80, 81, 16, 12, 13]]
1
471
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, x, i, j, k, l, ans, z, h; cin >> n >> m >> x; int a[n][m + 1], b[m + 1]; for (i = 0; i < n; i++) { for (j = 0; j <= m; j++) { cin >> a[i][j]; } } l = pow(2, n); ans = 1200001; for (i = 1; i < l; i++...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m, x, i, j, k, l, ans, z, h; cin >> n >> m >> x; int a[n][m + 1], b[m + 1]; for (i = 0; i < n; i++) { for (j = 0; j <= m; j++) { cin >> a[i][j]; } } l = pow(2, n); ans = 1200001; for (i = 1; i < l; i++...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 17, 19]]
1
288
#include <bits/stdc++.h> using namespace std; typedef long long ll; //マクロ // forループ関係 //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか // Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for...
#include <bits/stdc++.h> using namespace std; typedef long long ll; //マクロ // forループ関係 //引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか // Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) #define REPD(i, n) for (ll i = n - 1; i >= 0; i--) #define FOR(i, a, b) for...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
386
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> A(N, vector<int>(M + 1)); vector<int> V(M + 1); for (int i = 0; i < N; i++) { for (int j = 0; j < M + 1; j++) { cin >> A[i][j]; } } ll ans = 1e9; for (i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int N, M, X; cin >> N >> M >> X; vector<vector<int>> A(N, vector<int>(M + 1)); vector<int> V(M + 1); for (int i = 0; i < N; i++) { for (int j = 0; j < M + 1; j++) { cin >> A[i][j]; } } ll ans = 1e9; for (i...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
289
# -*- coding: utf-8 -*- import itertools # スペース区切りの整数の入力 N, M, X = map(int, input().split()) # 文字列の入力 #s = input() #開業されたN個要素を受け付ける input_list = [list(map(int, input().split())) for i in range(N)] #print(input_list) ans = -1 flg=1 for i in range(N): if i ==0: continue c = list(itertools.combinations(...
# -*- coding: utf-8 -*- import itertools # スペース区切りの整数の入力 N, M, X = map(int, input().split()) # 文字列の入力 #s = input() #開業されたN個要素を受け付ける input_list = [list(map(int, input().split())) for i in range(N)] #print(input_list) ans = -1 flg=1 for i in range(N+1): if i ==0: continue c = list(itertools.combination...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
190
n,m,x = map(int,input().split()) c = [[int(i) for i in input().split()] for _ in range(n)] import itertools max_=-1 for i in range(n): c_list = list(itertools.combinations(c, i+1)) for j in c_list: d=[0]*m for k in j: d = [x+y for (x,y) in zip(d,k)] f=1 for l in rang...
n,m,x = map(int,input().split()) c = [[int(i) for i in input().split()] for _ in range(n)] import itertools max_=-1 for i in range(n): c_list = list(itertools.combinations(c, i+1)) for j in c_list: d=[0]*(m+1) for k in j: d = [x+y for (x,y) in zip(d,k)] f=1 for l in ...
[["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 24], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 17, 72], ["+", 0, 662, 12, 657, 12, 23, 0, 657, 12, 612], ["+", 0, 1, 0, 662, 12, 657, 12, 23, 0, 25], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
171
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m, x; cin >> n >> m >> x; vector<int> price(n); int ans = 999999999; vector<vector<int>> plus(n, vector<int>(m)); vector<int> skill(m); int temp; bool flag; for (int i = 0; i < n; i++) { cin >> price[i]; for (int j = 0; ...
#include <bits/stdc++.h> using namespace std; int main(void) { int n, m, x; cin >> n >> m >> x; vector<int> price(n); int ans = 999999999; vector<vector<int>> plus(n, vector<int>(m)); vector<int> skill(m); int temp; bool flag; for (int i = 0; i < n; i++) { cin >> price[i]; for (int j = 0; ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 64, 1, 0, 16, 17, 60], ["+", 8, 9, 0, 57, 64, 1, 0, 11, 17, 32]]
1
349
# -*- coding: utf-8 -*- """ Created on Sun May 10 20:50:51 2020 """ import sys #import numpy as np import itertools sys.setrecursionlimit(10 ** 9) #def input(): # return sys.stdin.readline()[:-1] mod = 10**9+7 N,M,X = map(int,input().split()) ca = [list(map(int,input().split())) for _ in range(N)] ans = 10 ** 9 ...
# -*- coding: utf-8 -*- """ Created on Sun May 10 20:50:51 2020 """ import sys #import numpy as np import itertools sys.setrecursionlimit(10 ** 9) #def input(): # return sys.stdin.readline()[:-1] mod = 10**9+7 N,M,X = map(int,input().split()) ca = [list(map(int,input().split())) for _ in range(N)] ans = 10 ** 9 ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
184
import itertools import numpy as np n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for i in range(n)] coin = [] for i in range(1, m+1): for v in itertools.combinations(books, i): comb = list(v) result = np.sum(comb, axis = 0) flag = True for j in range(1,m+1): if ...
import itertools import numpy as np n, m, x = map(int, input().split()) books = [list(map(int, input().split())) for i in range(n)] coin = [] for i in range(1, n+1): for v in itertools.combinations(books, i): comb = list(v) result = np.sum(comb, axis = 0) flag = True for j in range(1,m+1): ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22]]
5
165
import sys from math import log2,floor,ceil,sqrt # import bisect sys.setrecursionlimit(10**5) # from collections import deque Ri = lambda : [int(x) for x in sys.stdin.readline().split()] ri = lambda : sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b f...
import sys from math import log2,floor,ceil,sqrt # import bisect sys.setrecursionlimit(10**5) # from collections import deque Ri = lambda : [int(x) for x in sys.stdin.readline().split()] ri = lambda : sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b f...
[["-", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 64, 196, 0, 1, 0, 662, 12, 657, 12, 22]]
5
568
N, M, X = gets.chomp.split(' ').map(&:to_i) C = Array.new N.times do |i| C[i] = gets.chomp.split(' ').map(&:to_i) end min = Float::INFINITY N.times do |i| combinations = (0..N-1).to_a.combination(i+1).to_a combinations.each do |combination| sum = Array.new(M, 0) M.times do |k| (i+1).times do |j| ...
N, M, X = gets.chomp.split(' ').map(&:to_i) C = Array.new N.times do |i| C[i] = gets.chomp.split(' ').map(&:to_i) end min = Float::INFINITY N.times do |i| combinations = (0..N-1).to_a.combination(i+1).to_a combinations.each do |combination| sum = Array.new(M+1, 0) (M+1).times do |k| (i+1).times do ...
[["+", 0, 662, 12, 652, 3, 4, 0, 738, 17, 72], ["+", 0, 662, 12, 652, 3, 4, 0, 738, 12, 612], ["+", 196, 737, 8, 736, 0, 652, 486, 739, 0, 24], ["+", 8, 736, 0, 652, 486, 739, 0, 738, 17, 72], ["+", 8, 736, 0, 652, 486, 739, 0, 738, 12, 612], ["+", 196, 737, 8, 736, 0, 652, 486, 739, 0, 25]]
4
186
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n, 0); vector<vector<int>> a(n, vector<int>(m, 0)); rep(i, n) { cin >> c[i]; rep(j...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, s, n) for (int i = (s); i < (int)(n); i++) int main() { int n, m, x; cin >> n >> m >> x; vector<int> c(n, 0); vector<vector<int>> a(n, vector<int>(m, 0)); rep(i, n) { cin >> c[i]; rep(j...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13]]
1
309
import itertools def get_target_list(source): targets = [] for size in range(1, len(source) + 1): for x in itertools.combinations(source, size): targets.append(x) return targets paramN, paramM, paramX = list(map(lambda x: int(x), input().split(' '))) targets = get_target_list([list(map...
import itertools def get_target_list(source): targets = [] for size in range(1, len(source) + 1): for x in itertools.combinations(source, size): targets.append(x) return targets paramN, paramM, paramX = list(map(lambda x: int(x), input().split(' '))) targets = get_target_list([list(map...
[["-", 8, 196, 0, 1, 0, 662, 12, 658, 8, 22], ["+", 8, 196, 0, 1, 0, 662, 12, 658, 8, 612], ["-", 0, 7, 8, 196, 0, 7, 31, 684, 0, 22], ["+", 0, 7, 8, 196, 0, 7, 31, 684, 0, 22], ["-", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22], ["+", 8, 196, 0, 1, 0, 677, 31, 206, 206, 22]]
5
214
#include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; typedef long long ll; int n, M, x; int m[15][15], cost[15]; int main() { scanf("%d%d%d", &n, &M, &x); for (int i = 1; i <= n; i++) { scanf("%d", &cost[i]); for (int j = 1; j <= M; j++) scanf("%d", &m[i][j]); } int ans = INF; fo...
#include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; typedef long long ll; int n, M, x; int m[15][15], cost[15]; int main() { scanf("%d%d%d", &n, &M, &x); for (int i = 1; i <= n; i++) { scanf("%d", &cost[i]); for (int j = 1; j <= M; j++) scanf("%d", &m[i][j]); } int ans = INF; fo...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
302
import numpy as np n,m,x=list(map(int,input().split())) lis=[] for i in range(n): l=list(map(int,input().split())) lis.append(l) min=-1 for nnn in range(2**n): index=[] a=nnn for i in range(n): index.append(a%2) a//=2 money=0 xs=np.zeros(n) for i in range(n): ...
import numpy as np n,m,x=list(map(int,input().split())) lis=[] for i in range(n): l=list(map(int,input().split())) lis.append(l) min=-1 for nnn in range(2**n): index=[] a=nnn for i in range(n): index.append(a%2) a//=2 money=0 xs=np.zeros(m) for i in range(n): ...
[["-", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 22]]
5
182
def mips(): return map(int,input().split()) def msps(): return map(str,input().split()) import sys import itertools N,M,X = mips() know = dict() price = [[] for _ in range(N)] L = [] C = [] for i in range(M): know[i] = 0 for i in range(N): L.append([i for i in mips()]) C.append(L[i][0]) L[i].re...
def mips(): return map(int,input().split()) def msps(): return map(str,input().split()) import sys import itertools N,M,X = mips() know = dict() price = [[] for _ in range(N)] L = [] C = [] for i in range(M): know[i] = 0 for i in range(N): L.append([i for i in mips()]) C.append(L[i][0]) L[i].re...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
314
from itertools import combinations n,m,x = map(int,input().split()) cost_lists = [list(map(int,input().split())) for _ in range(n)] # print(cost_lists) min_cost = 10**9 unst_flag = False for i in range(1, n+1): combi_lists = list(combinations(range(n), i)) for combi_list in combi_lists: tmp_list = ...
from itertools import combinations n,m,x = map(int,input().split()) cost_lists = [list(map(int,input().split())) for _ in range(n)] # print(cost_lists) min_cost = 10**9 unst_flag = False for i in range(1, n+1): combi_lists = list(combinations(range(n), i)) for combi_list in combi_lists: tmp_list = ...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
176
import copy import itertools import sys n, m, x = map(int, input().split()) us = [0 for _ in range(m)] l = [] for i in range(n): row = [int(i) for i in input().split()] l.append(copy.deepcopy(row)) # 最初の一つをx以上にする組み合わせ first = [] c = 0 for i in range(1, n+1): c = itertools.combinations(range(n), i) f...
import copy import itertools import sys n, m, x = map(int, input().split()) us = [0 for _ in range(m)] l = [] for i in range(n): row = [int(i) for i in input().split()] l.append(copy.deepcopy(row)) # 最初の一つをx以上にする組み合わせ first = [] c = 0 for i in range(1, n+1): c = itertools.combinations(range(n), i) f...
[["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 24], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 17, 48], ["+", 0, 662, 12, 657, 31, 23, 0, 657, 12, 22], ["+", 0, 1, 0, 662, 12, 657, 31, 23, 0, 25]]
5
257
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mod 1000000007 #define MAX 100000 void inarray(int a[], int n) { for (int i = 0; i < n; i++) cin >> a[i]; } int main() { int n, m, x; cin >> n >> m >> x; ll c[n], a[n][m]; for (int i = 0; i < n; i++) { cin >> c[i]; for (i...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define mod 1000000007 #define MAX 100000 void inarray(int a[], int n) { for (int i = 0; i < n; i++) cin >> a[i]; } int main() { int n, m, x; cin >> n >> m >> x; ll c[n], a[n][m]; for (int i = 0; i < n; i++) { cin >> c[i]; for (i...
[["-", 15, 16, 12, 16, 31, 2, 3, 4, 0, 22], ["-", 15, 16, 12, 16, 31, 2, 3, 4, 0, 21], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 21], ["+", 0, 7, 15, 16, 12, 2, 3, 4, 0, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
335
import itertools def main(N, M, X, CA): cand = [] for n in range(N): # n個選ぶ for ca in itertools.combinations(CA, n): s, price = f(ca) if all(i >= X for i in s): cand.append(price) if len(cand) == 0: print(-1) else: print(min(cand)) def ...
import itertools def main(N, M, X, CA): cand = [] for n in range(N): # n個選ぶ for ca in itertools.combinations(CA, n+1): s, price = f(ca) if all(i >= X for i in s): cand.append(price) if len(cand) == 0: print(-1) else: print(min(cand)) de...
[["+", 0, 7, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
212
n, m, x = list(map(int, input().split())) c = [] a = [] for i in range(n): tmp = list(map(int, input().split())) a.append(tmp[1:]) c.append(tmp[0]) goal = [x] * (m) def infer(ans): for i in range(m): if goal[i] > ans[i]: return False return True cost = 10 ** 5 flag = False fo...
n, m, x = list(map(int, input().split())) c = [] a = [] for i in range(n): tmp = list(map(int, input().split())) a.append(tmp[1:]) c.append(tmp[0]) goal = [x] * (m) def infer(ans): for i in range(m): if goal[i] > ans[i]: return False return True cost = 10 ** 12 flag = False f...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612]]
5
215
#include <bits/stdc++.h> using namespace std; #define int long long int #define f first #define s second #define pb push_back signed main() { int n, m, x; cin >> n >> m >> x; int a[n][m]; int cost[n]; for (int i = 0; i < n; i++) { cin >> cost[i]; for (int j = 0; j < n; j++) cin >> a[i][j]; } ...
#include <bits/stdc++.h> using namespace std; #define int long long int #define f first #define s second #define pb push_back signed main() { int n, m, x; cin >> n >> m >> x; int a[n][m]; int cost[n]; for (int i = 0; i < n; i++) { cin >> cost[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
336
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int N, M, X; scanf("%d %d %d", &N, &M, &X); int C[N], A[N][M]; int S[N]; int min = 1000000000, S_m; for (int i = 0; i < N; i++) { scanf("%d", &C[i]); for (int j = 0; j < M; j++) { scanf("%d", &A[i][j]); ...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int N, M, X; scanf("%d %d %d", &N, &M, &X); int C[N], A[N][M]; int S[M]; int min = 1000000000, S_m; for (int i = 0; i < N; i++) { scanf("%d", &C[i]); for (int j = 0; j < M; j++) { scanf("%d", &A[i][j]); ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22]]
0
324
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define inputInt(a) \ int a; \ cin >> a; #define inputInt2(a, b) \...
#include <bits/stdc++.h> #include <stdio.h> using namespace std; #define inputInt(a) \ int a; \ cin >> a; #define inputInt2(a, b) \...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
1,489
import itertools def check(arr,t): for i in arr: if i < t: return False return True N,M,X = list(map(int,input().split())) l = [] for _ in range(N): l.append(list(map(int,input().split()))) buy_bit = list(itertools.product([0,1], repeat=N)) mi = 99999999999999999 for pattern in buy_bit...
import itertools def check(arr,t): for i in arr: if i < t: return False return True N,M,X = list(map(int,input().split())) l = [] for _ in range(N): l.append(list(map(int,input().split()))) buy_bit = list(itertools.product([0,1], repeat=N)) mi = 990000000 for pattern in buy_bit: l...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 17, 72], ["+", 0, 1, 0, 677, 12, 206, 206, 657, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
194
import itertools N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] kakaku = 100001 combinations = [] for n in range(1, N+1): combinations += list(itertools.combinations(range(N), n)) for pair in combinations: hantei = True for m in range(M): total = 0 ...
import itertools N, M, X = map(int, input().split()) CA = [list(map(int, input().split())) for _ in range(N)] kakaku = 9999999 combinations = [] for n in range(1, N+1): combinations += list(itertools.combinations(range(N), n)) for pair in combinations: hantei = True for m in range(M): total = 0 ...
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 12, 612], ["-", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612], ["+", 36, 36, 0, 656, 0, 57, 15, 666, 0, 612]]
5
175