Submission #671731

#TimeUsernameProblemLanguageResultExecution timeMemory
671731LittleCubeCloud Computing (CEOI18_clo)C++14
100 / 100
471 ms1364 KiB
#include <bits/stdc++.h> #define ll long long #define plll tuple<ll, ll, ll> using namespace std; ll n, m, dp[100005]; vector<plll> items; signed main() { cin >> n; for (int i = 1; i <= n; i++) { int c, f, v; cin >> c >> f >> v; items.emplace_back(make_tuple(f, c, -v)); } cin >> m; for (int i = 1; i <= m; i++) { int c, f, v; cin >> c >> f >> v; items.emplace_back(make_tuple(f, -c, v)); } sort(items.begin(), items.end(), greater<>()); for (int i = 1; i <= n * 50; i++) dp[i] = -1e18; for (int i = 1; i <= n + m; i++) { auto [f, c, v] = items[i - 1]; if (c > 0) for (int j = n * 50; j >= c; j--) dp[j] = max(dp[j], dp[j - c] + v); else for (int j = 0; j <= n * 50 + c; j++) dp[j] = max(dp[j], dp[j - c] + v); } ll ans = 0; for (int i = 0; i <= n * 50; i++) ans = max(ans, dp[i]); cout << ans << '\n'; }

Compilation message (stderr)

clo.cpp: In function 'int main()':
clo.cpp:30:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   30 |         auto [f, c, v] = items[i - 1];
      |              ^
#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...