Submission #1774764


Source Code Expand

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

int main() {
    int n, d, x;
    cin >> n >> d >> x;
    vector<vector<int>> p(d, vector<int>(n));
    for (int i = 0; i < d; ++i) {
        for (int j = 0; j < n; ++j)
            cin >> p[i][j];

        if (i) {
            vector<int> dp(100010);
            for (int j = 0; j < 100010; ++j)
                dp[j] = j;
            for (int j = 0; j < n; ++j)
                for (int k = p[i - 1][j]; k < 100010; ++k)
                    dp[k] = max(dp[k], dp[k - p[i - 1][j]] + p[i][j]);

            x = dp[x];
        }
    }
    cout << x << "\n";
    return 0;
}

Submission Info

Submission Time
Task A - Invest Master
User riantkb
Language C++14 (GCC 5.4.1)
Score 100
Code Size 644 Byte
Status AC
Exec Time 15 ms
Memory 640 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 35
Set Name Test Cases
All 00_sample01.txt, 00_sample02.txt, 00_sample03.txt, 00_sample04.txt, 05_anti_greedy.txt, 10_rand_small00.txt, 10_rand_small01.txt, 10_rand_small02.txt, 10_rand_small03.txt, 10_rand_small04.txt, 10_rand_small05.txt, 10_rand_small06.txt, 10_rand_small07.txt, 10_rand_small08.txt, 10_rand_small09.txt, 20_rand_medium00.txt, 20_rand_medium01.txt, 20_rand_medium02.txt, 20_rand_medium03.txt, 20_rand_medium04.txt, 20_rand_medium05.txt, 20_rand_medium06.txt, 20_rand_medium07.txt, 20_rand_medium08.txt, 20_rand_medium09.txt, 30_rand_large00.txt, 30_rand_large01.txt, 30_rand_large02.txt, 30_rand_large03.txt, 30_rand_large04.txt, 30_rand_large05.txt, 30_rand_large06.txt, 30_rand_large07.txt, 30_rand_large08.txt, 30_rand_large09.txt
Case Name Status Exec Time Memory
00_sample01.txt AC 2 ms 640 KB
00_sample02.txt AC 2 ms 640 KB
00_sample03.txt AC 2 ms 640 KB
00_sample04.txt AC 3 ms 640 KB
05_anti_greedy.txt AC 2 ms 640 KB
10_rand_small00.txt AC 2 ms 640 KB
10_rand_small01.txt AC 2 ms 640 KB
10_rand_small02.txt AC 2 ms 640 KB
10_rand_small03.txt AC 2 ms 640 KB
10_rand_small04.txt AC 2 ms 640 KB
10_rand_small05.txt AC 2 ms 640 KB
10_rand_small06.txt AC 2 ms 640 KB
10_rand_small07.txt AC 2 ms 640 KB
10_rand_small08.txt AC 2 ms 640 KB
10_rand_small09.txt AC 2 ms 640 KB
20_rand_medium00.txt AC 3 ms 640 KB
20_rand_medium01.txt AC 3 ms 640 KB
20_rand_medium02.txt AC 3 ms 640 KB
20_rand_medium03.txt AC 3 ms 640 KB
20_rand_medium04.txt AC 3 ms 640 KB
20_rand_medium05.txt AC 3 ms 640 KB
20_rand_medium06.txt AC 3 ms 640 KB
20_rand_medium07.txt AC 3 ms 640 KB
20_rand_medium08.txt AC 3 ms 640 KB
20_rand_medium09.txt AC 3 ms 640 KB
30_rand_large00.txt AC 15 ms 640 KB
30_rand_large01.txt AC 15 ms 640 KB
30_rand_large02.txt AC 15 ms 640 KB
30_rand_large03.txt AC 15 ms 640 KB
30_rand_large04.txt AC 15 ms 640 KB
30_rand_large05.txt AC 15 ms 640 KB
30_rand_large06.txt AC 15 ms 640 KB
30_rand_large07.txt AC 15 ms 640 KB
30_rand_large08.txt AC 15 ms 640 KB
30_rand_large09.txt AC 15 ms 640 KB