Submission #789694

#TimeUsernameProblemLanguageResultExecution timeMemory
789694MISM06Cloud Computing (CEOI18_clo)C++14
18 / 100
221 ms2892 KiB
//0 1 1 0 1 //0 1 0 0 1 //1 0 0 1 1 //0 1 1 0 1 #include <bits/stdc++.h> #pragma GCC optimize("Ofast,unroll-loops") // #pragma GCC target("avx2") using namespace std; #define F first #define S second #define pb push_back #define sze size() #define all(x) x.begin() , x.end() #define wall__ cout << "--------------------------------------\n"; #define kids int mid = (tl + tr) >> 1, cl = v << 1, cr = v << 1 | 1 #define file_io freopen("input.cpp", "r", stdin); freopen("output.cpp", "w", stdout); typedef long long ll; typedef long double dl; typedef pair < int , int > pii; typedef pair < int , ll > pil; typedef pair < ll , int > pli; typedef pair < ll , ll > pll; typedef pair < int , pii > piii; typedef pair < ll, pll > plll; const ll N = 2000 + 10, M = N * 100; const ll mod = 1e9 + 7; const ll inf = 2e16; const ll INF = 1e9 + 10; const ll lg = 32; ll dp[M + M], c1[N], c2[N], v1[N], v2[N], f1[N], f2[N]; int n, m; void solve () { cin >> n; for (int i = 1; i <= n; i++) { cin >> c1[i] >> f1[i] >> v1[i]; } cin >> m; for (int i = 1; i <= m; i++) { cin >> c2[i] >> f2[i] >> v2[i]; } for (int i = M + 1; i < M + M; ++i) dp[i] = -inf; for (int i = 1; i <= n; i++) { for (int j = i * 50; j >= 0; --j) { dp[j + M] = max(dp[j + M], dp[j - c1[i] + M] - v1[i]); } } for (int i = 1; i <= m; i++) { for (int j = i * -50; j <= n * 50; j++) { dp[j + M] = max(dp[j + M], dp[j + c2[i] + M] + v2[i]); } } cout << dp[0 + M] << '\n'; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; while (t--) {solve();} return 0; } /* */ //shrek is love;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...