/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 9ms 26.422 MiB
#2 Wrong Answer 17ms 26.402 MiB
#3 Accepted 514ms 26.398 MiB
#4 Accepted 91ms 26.406 MiB
#5 Accepted 70ms 26.398 MiB
#6 Accepted 36ms 26.395 MiB
#7 Accepted 532ms 26.398 MiB
#8 Accepted 10ms 26.355 MiB
#9 Accepted 9ms 26.172 MiB
#10 Accepted 10ms 26.207 MiB
#11 Accepted 11ms 26.23 MiB
#12 Accepted 32ms 26.406 MiB
#13 Wrong Answer 84ms 26.402 MiB

Code

#include <bits/stdc++.h>
using namespace std;

vector<array<int, 4>> v;

void BaseCases() {
    v.push_back({0, 0, 3, 0});
    v.push_back({1, 1, 2, 0});
    v.push_back({3, 0, 2, 0});
    v.push_back({0, 0, 1, 2});
    v.push_back({1, 1, 1, 1});
    v.push_back({3, 0, 1, 1});
    v.push_back({0, 3, 1, 0});
    v.push_back({2, 2, 1, 0});
    v.push_back({4, 1, 1, 0});
    v.push_back({6, 0, 1, 0});
    v.push_back({1, 1, 0, 2});
    v.push_back({3, 0, 0, 2});
    v.push_back({2, 2, 0, 1});
    v.push_back({4, 1, 0, 1});
    v.push_back({6, 0, 0, 1});
    v.push_back({1, 4, 0, 0});
    v.push_back({3, 3, 0, 0});
    v.push_back({5, 2, 0, 0});
    v.push_back({7, 1, 0, 0});
    v.push_back({9, 0, 0, 0});
}

int dp[51][51][51][51];

int f(int a, int b, int c, int d) {
    if (a < 0 || b < 0 || c < 0 || d < 0) return -1;
    if (a == 0 && b == 0 && c == 0 && d == 0) return 0; 

    if (dp[a][b][c][d] != -1) return dp[a][b][c][d];

    int res = 0; 
    for (auto &[i, j, k, l] : v) {
        if (i <= a && j <= b && k <= c && l <= d) {
            res = max(res, f(a - i, b - j, c - k, d - l) + 1);
        }
    }

    return dp[a][b][c][d] = res;
}

void solve(int cs) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    memset(dp, -1, sizeof(dp));
    cout << "Case " << cs << ": " << f(a, b, c, d) << "\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int tc;
    cin >> tc;
    BaseCases();
    for (int cs = 1; cs <= tc; cs++) {
        solve(cs);
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1014 FIFA World Cup 2022 Again!
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-13 09:31:15
Judged At
2025-01-15 12:29:36
Judged By
Score
19
Total Time
532ms
Peak Memory
26.422 MiB