标签:out view register bre long line int one typedef
暴搜。。。我去除了比某一同类装备4个属性都低的装备
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for (register int i = a; i <= b; i++) typedef struct clo { int a, b, c, d; } cloth; int n, k, A, B, C, D, T; ll ans; vector<cloth> p[55]; void dfs(int x, int a, int b, int c, int d) { while (x <= k && p[x].empty()) x++; if (x > k) { ans = max(ans, 1ll * a * b * c * d); return; } for (vector<cloth>::iterator it = p[x].begin(); it != p[x].end(); it++) dfs(x + 1, a + (*it).a, b + (*it).b, c + (*it).c, d + (*it).d); } inline void solve() { cin >> n >> k; rep(i, 1, k) p[i].clear(); ans = 100000000; rep(i, 1, n) { cin >> T >> A >> B >> C >> D; int flag = 1; for (vector<cloth>::iterator it = p[T].begin(); it != p[T].end(); it++) { if (A <= (*it).a && B <= (*it).b && C <= (*it).c && D <= (*it).d) { flag = 0; break; } } if (flag) p[T].push_back({A, B, C, D}); } dfs(1, 100, 100, 100, 100); cout << ans << endl; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; cin >> t; while (t--) { solve(); } }
标签:out view register bre long line int one typedef
原文地址:https://www.cnblogs.com/likunhong/p/13368606.html