/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 31ms 99.578 MiB
#2 Wrong Answer 32ms 99.57 MiB
#3 Accepted 388ms 99.605 MiB
#4 Accepted 82ms 99.613 MiB
#5 Accepted 74ms 99.605 MiB
#6 Accepted 32ms 99.379 MiB
#7 Accepted 85ms 99.609 MiB
#8 Accepted 35ms 99.52 MiB
#9 Accepted 32ms 99.484 MiB
#10 Accepted 33ms 99.363 MiB
#11 Accepted 32ms 99.543 MiB
#12 Accepted 32ms 99.379 MiB
#13 Wrong Answer 86ms 99.609 MiB

Code

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

#define endl '\n'
#ifdef LOCAL
    #include "debug.h"    
#else
    #define print(...)
    #define printt(...)
#endif

#define int long long

vector<array<int, 4>> v = {
    {9, 0, 0, 0},
    {7, 1, 0, 0},
    {5, 2, 0, 0},
    {3, 3, 0, 0},
    {1, 4, 0, 0},
    
    {6, 0, 0, 1},
    {4, 1, 0, 1},
    {2, 2, 0, 1},
    {0, 3, 0, 1},
    {3, 0, 1, 1},

    {3, 0, 0, 2},
    {0, 0, 1, 2},
    {1, 1, 0, 2},
    
    {0, 0, 3, 0},
    {3, 0, 2, 0},
    {1, 1, 2, 0},
    {6, 0, 1, 0},
    {4, 1, 1, 0},
    {2, 2, 1, 0},
    {0, 3, 1, 0},

    {1, 1, 1, 1}
};

int dp[60][60][60][60];

int DP(int a, int b, int c, int d) {
    if(a < 0 or b < 0 or c < 0 or d < 0)return -1;

    if(a == 0 and b == 0 and c == 0 and 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 and j <= b and k <= c and l <= d) {
            res = max(res, DP(a - i, b - j, c - k, d - l) + 1);
        }
    }

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

void run(){
    
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    cout << DP(a, b, c, d) << endl;   
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    memset(dp, -1, sizeof(dp));

    int t = 1, cs = 1;
    cin >> t;

    while( t --> 0 ) {
        cout << "Case " << cs++ << ": ";
        run();
    }
    
    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-10 13:13:33
Judged At
2025-01-10 18:01:15
Judged By
Score
11
Total Time
388ms
Peak Memory
99.613 MiB