QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#319889 | #2491. Gas and Minerals | rgnerdplayer | WA | 0ms | 3640kb | C++20 | 646b | 2024-02-03 11:31:14 | 2024-02-03 11:31:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
int M, G, n;
cin >> M >> G >> n;
vector dp(M + 1, vector<int>(G + 1));
while (n--) {
int a, b, c;
cin >> a >> b >> c;
for (int i = M; i >= a; i--) {
for (int j = G; j >= b; j--) {
dp[i][j] = max(dp[i][j], dp[i - a][j - b] + c);
}
}
}
cout << dp[M][G] << '\n';
};
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
10 10 3 7 0 6 6 2 7 2 5 5
output:
12
result:
ok single line: '12'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3572kb
input:
11 10 3 7 0 6 6 2 7 2 5 5
output:
12
result:
wrong answer 1st lines differ - expected: '16', found: '12'