/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 540.0 KiB
#2 Wrong Answer 1ms 328.0 KiB

Code

/*One touch and i IGNITE*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define endl "\n"
#define Endl "\n"

const int N = 2e5 + 5;
int tc, n, casee = 1, a, b, c, d;
int dp[50][50][50][50];

struct R {
    int a, b, c, d;
};

vector<R> v;

void buildBaseCase() {
    /// this is --a, b, c, d
    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 rec(int a, int b, int c, int d) {

    bool notPossible = true;
    for (auto i : v) {
        if (i.a <= a && i.b <= b && i.c <= c && i.d <= d) {
            notPossible = false;
            break;
        }
    }
    if (notPossible)
        return 0;
    int &ret = dp[a][b][c][d];
    if (~ret)
        return ret;
    ret = 0;

    for (auto i : v) {
        if (i.a <= a && i.b <= b && i.c <= c && i.d <= d) {
            ret = max(ret, 1 + rec(a - i.a, b - i.b, c - i.c, d - i.d));
        }
    }

    return ret;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); // cout.tie(0);
    freopen("Input/input39.txt", "r", stdin);
    freopen("Output/output39.txt", "w", stdout);
    buildBaseCase();
    cin >> tc;
    while (tc--) {
        cin >> a >> b >> c >> d;
        memset(dp, -1, sizeof dp);
        int Ans = rec(a, b, c, d);
        cout << "Case " << casee++ << ": " << Ans << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1014 FIFA World Cup 2022 Again!
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-14 12:23:29
Judged At
2025-01-14 12:48:57
Judged By
Score
0
Total Time
1ms
Peak Memory
540.0 KiB