Submission #17489485


Source Code Expand

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

typedef pair<int, int> P;
typedef long long ll;

int dp[102][102][102];

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> a(N), b(N), c(N), w(N);

    for(int i = 0; i < N; ++i){
        cin >> a[i] >> b[i] >> c[i] >> w[i];
        dp[a[i]][b[i]][c[i]] = max(dp[a[i]][b[i]][c[i]], w[i]);
    }

    vector<int> x(M), y(M), z(M);
    for(int i = 0; i < M; ++i){
        cin >> x[i] >> y[i] >> z[i];
    }

    for(int i = 0; i < 100; ++i) {
        dp[i + 1][0][0] = max(dp[i + 1][0][0], dp[i][0][0]);
        dp[0][i + 1][0] = max(dp[0][i + 1][0], dp[0][i][0]);
        dp[0][0][i + 1] = max(dp[0][0][i + 1], dp[0][0][i]);
    }


    for(int i = 0; i < 101; ++i){
        for(int j = 0; j < 101; ++j){
            for(int k = 0; k < 101; ++k){
                // dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k]);
                // dp[i][j + 1][k] = max(dp[i][j + 1][k], dp[i][j][k]);
                // dp[i][j][k + 1] = max(dp[i][j][k + 1], dp[i][j][k]);
                dp[i][j][k] = max(dp[i][j][k], max(dp[i - 1][j][k], max(dp[i][j - 1][k], dp[i][j][k - 1]))); 
            }
        }
    }

    for(int i = 0; i < M; ++i){
        cout << dp[x[i]][y[i]][z[i]] << endl;
    }

    return 0;
}

Submission Info

Submission Time
Task A - Table Tennis
User URASUMA
Language C++ (GCC 9.2.1)
Score 0
Code Size 1307 Byte
Status
Exec Time 110 ms
Memory 3860 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
× 27
Set Name Test Cases
All 00-sample-00.txt, 00-sample-01.txt, 10-unique-00.txt, 10-unique-01.txt, 10-unique-02.txt, 10-unique-03.txt, 10-unique-04.txt, 20-order-00.txt, 20-order-01.txt, 20-order-02.txt, 20-order-03.txt, 20-order-04.txt, 30-random-00.txt, 30-random-01.txt, 30-random-02.txt, 30-random-03.txt, 30-random-04.txt, 30-random-05.txt, 30-random-06.txt, 30-random-07.txt, 30-random-08.txt, 30-random-09.txt, 30-random-10.txt, 30-random-11.txt, 30-random-12.txt, 30-random-13.txt, 30-random-14.txt
Case Name Status Exec Time Memory
00-sample-00.txt 110 ms 3756 KB
00-sample-01.txt 107 ms 3796 KB
10-unique-00.txt 108 ms 3420 KB
10-unique-01.txt 107 ms 3236 KB
10-unique-02.txt 105 ms 3764 KB
10-unique-03.txt 108 ms 3168 KB
10-unique-04.txt 108 ms 3688 KB
20-order-00.txt 109 ms 3860 KB
20-order-01.txt 110 ms 3252 KB
20-order-02.txt 107 ms 3420 KB
20-order-03.txt 106 ms 3256 KB
20-order-04.txt 108 ms 3172 KB
30-random-00.txt 106 ms 3668 KB
30-random-01.txt 105 ms 3168 KB
30-random-02.txt 108 ms 3308 KB
30-random-03.txt 107 ms 3212 KB
30-random-04.txt 108 ms 3204 KB
30-random-05.txt 109 ms 3224 KB
30-random-06.txt 108 ms 3424 KB
30-random-07.txt 107 ms 3236 KB
30-random-08.txt 108 ms 3172 KB
30-random-09.txt 107 ms 3360 KB
30-random-10.txt 110 ms 3368 KB
30-random-11.txt 107 ms 3252 KB
30-random-12.txt 105 ms 3352 KB
30-random-13.txt 108 ms 3312 KB
30-random-14.txt 109 ms 3232 KB