QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#586998 | #5303. No Bug No Game | Nephrenn | WA | 41ms | 35612kb | C++20 | 1.1kb | 2024-09-24 17:01:27 | 2024-09-24 17:01:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const i64 INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 3010;
int n, k, p[MAXN];
i64 w[MAXN][20];
i64 dp[MAXN];
vector<int> not_select[MAXN];
void solve () {
cin >> n >> k;
for (int i = 1; i <= n; ++i) {
cin >> p[i];
for (int j = 1; j <= p[i]; ++j) {
cin >> w[i][j];
}
}
for (int i = 1; i <= n; ++i) {
for (int j = k; j >= p[i]; --j) {
if (dp[j] >= dp[j - p[i]] + w[i][p[i]]) {
not_select[j].push_back(i);
} else {
dp[j] = dp[j - p[i]] + w[i][p[i]];
}
}
}
i64 ans = dp[k];
for (int i = k - 1; i >= 0; --i) {
int sp = k - i;
for (auto j : not_select[i]) {
if (sp < p[j]) ans = max(ans, dp[i] + w[j][sp]);
}
}
cout << ans << "\n";
}
int main () {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
solve ();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3568kb
input:
4 5 2 1 3 2 1 1 2 3 1 2 1 3
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: 0
Accepted
time: 32ms
memory: 35144kb
input:
3000 3000 10 70562 30723 79371 82224 63977 3362 26909 96449 48163 66159 4 18007 33590 80674 91139 4 10304 31694 70745 50656 10 63090 17226 13187 73881 38137 15237 55750 82751 75854 39658 8 95640 66120 87735 36388 44046 92415 6952 94772 9 60565 27904 98726 87052 35768 25453 14563 34273 92501 10 66332...
output:
68279788
result:
ok 1 number(s): "68279788"
Test #3:
score: 0
Accepted
time: 36ms
memory: 35612kb
input:
3000 3000 7 63414 1471 67699 90007 79945 68096 24021 8 88988 13255 69503 8350 23580 4589 13918 43025 2 7666 45786 2 23237 48565 9 46170 76160 31929 26707 99 76847 64227 82880 99490 8 45937 52389 61039 13440 76101 49424 68485 47682 4 71757 34559 95339 27693 10 55332 93329 61008 26946 44148 73675 3776...
output:
70716917
result:
ok 1 number(s): "70716917"
Test #4:
score: 0
Accepted
time: 41ms
memory: 35136kb
input:
3000 3000 6 54485 55856 50343 67667 49501 76096 4 12436 88408 78352 13780 4 50966 49067 59688 80332 9 46560 57602 70521 97371 46436 28009 53076 80935 97421 3 95153 3255 48822 1 90375 6 55198 58182 28379 61019 61215 89332 8 64049 67076 1987 43389 6895 64126 73017 60143 2 5359 39166 9 95803 92377 3672...
output:
72397846
result:
ok 1 number(s): "72397846"
Test #5:
score: -100
Wrong Answer
time: 34ms
memory: 34732kb
input:
3000 3000 3 14784 32621 10730 7 66753 68601 10513 54658 95258 95000 26583 6 34297 97982 2242 91140 81325 57369 3 74322 55419 79533 9 26303 72513 25009 44015 57763 67938 65018 8793 18127 2 86236 22018 1 81085 5 97826 41038 57779 13095 94954 6 79827 5618 303 78145 32358 90650 9 62675 32720 44809 96682...
output:
72850277
result:
wrong answer 1st numbers differ - expected: '72850557', found: '72850277'