QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#319889#2491. Gas and MineralsrgnerdplayerWA 0ms3640kbC++20646b2024-02-03 11:31:142024-02-03 11:31:14

Judging History

This is the latest submission verdict.

  • [2024-02-03 11:31:14]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3640kb
  • [2024-02-03 11:31:14]
  • Submitted

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;
}

详细

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'