| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1340859 | msun | Cloud Computing (CEOI18_clo) | C++20 | 508 ms | 2008 KiB |
#include <algorithm>
#include <array>
#include <cstdio>
#include <cstring>
using namespace std;
#define MAXN 2001
#define MAXC 100001
// #define MAXC 100
array<int, 3> inp[2 * MAXN];
long long dp[MAXC], dp0[MAXC];
int
main ()
{
// freopen ("test.in", "r", stdin);
int N;
scanf ("%d", &N);
for (int i = 1; i <= N; ++i) {
int c, f, v;
scanf ("%d%d%d", &c, &f, &v);
inp[i][1] = c;
inp[i][0] = -f;
inp[i][2] = -v;
}
int M;
scanf ("%d", &M);
int len = N + M;
for (int i = N + 1; i <= len; ++i) {
int c, f, v;
scanf ("%d%d%d", &c, &f, &v);
inp[i][1] = -c;
inp[i][0] = -f;
inp[i][2] = v;
}
sort (inp + 1, inp + len + 1);
memset (dp, -0x3f, sizeof dp);
memset (dp0, -0x3f, sizeof dp);
dp[0] = dp0[0] = 0;
for (int i = 1; i <= len; ++i) {
auto [_, c, v] = inp[i];
for (int j = 0; j < MAXC; ++j)
if (j >= c && j - c < MAXC)
dp[j] = max (dp0[j], dp0[j - c] + v);
memcpy (dp0, dp, sizeof dp0);
}
long long ans = 0;
for (int i = 0; i < MAXC; ++i)
if (dp[i] > ans)
ans = dp[i];
printf ("%lld\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
