QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#809421 | #3157. IOI Manju | rlc202204 | 100 ✓ | 7ms | 3940kb | C++17 | 813b | 2024-12-11 14:58:13 | 2024-12-11 14:58:28 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 505;
const int M = 1e4 + 5;
const int inf = 0x3f3f3f3f;
int n, m;
int p[M] = {0};
int c[N] = {0}, e[N] = {0};
int f[M * 2] = {0};
int main() {
scanf("%d%d", &m, &n);
for (int i = 1; i <= m; i++)
scanf("%d", &p[i]);
sort(p + 1, p + m + 1, [](int x, int y){return x > y;});
memset(f, 0x3f, sizeof f);
f[0] = 0;
for (int i = 1; i <= n; i++) {
scanf("%d%d", &c[i], &e[i]);
for (int j = 20000; j >= c[i]; j--)
f[j] = min(f[j], f[j - c[i]] + e[i]);
}
for (int j = 20000; j >= 0; j--)
f[j] = min(f[j], f[j + 1]);
int ans = 0, sum = 0;
for (int j = 1; j <= m; j++) {
sum += p[j];
ans = max(ans, sum - f[j]);
}
cout << ans << endl;
return 0;
}
詳細信息
Subtask #1:
score: 25
Accepted
Test #1:
score: 25
Accepted
time: 1ms
memory: 3904kb
input:
1 1 9120 6124 9262
output:
0
result:
ok single line: '0'
Test #2:
score: 25
Accepted
time: 0ms
memory: 3880kb
input:
1 1 7581 9723 5615
output:
1966
result:
ok single line: '1966'
Test #3:
score: 25
Accepted
time: 2ms
memory: 3708kb
input:
10000 10 8046 7194 336 2003 9513 6069 6028 2032 6313 8692 2961 7390 7656 1927 7986 6722 5688 3857 4188 7671 3085 9169 3793 6263 9325 6354 2235 9136 524 6199 9392 296 746 8368 9787 2402 1263 274 9882 4694 8532 8001 6086 8455 6268 1858 9161 8987 1859 8893 3538 2364 3131 2305 442 24 9697 225 2204 2943 ...
output:
50209793
result:
ok single line: '50209793'
Test #4:
score: 25
Accepted
time: 1ms
memory: 3916kb
input:
10000 10 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 100...
output:
99999999
result:
ok single line: '99999999'
Test #5:
score: 25
Accepted
time: 0ms
memory: 3920kb
input:
10000 10 3 4 9 2 5 6 7 8 9 4 5 7 6 9 8 8 8 4 3 3 9 3 4 1 6 6 8 4 5 5 7 2 6 6 4 1 4 3 6 5 2 8 4 3 8 4 1 3 1 9 5 9 6 8 6 9 9 8 2 3 6 9 5 3 5 7 2 8 7 6 8 6 4 2 2 4 4 2 2 8 2 9 3 9 2 3 1 7 9 9 5 1 7 6 6 8 4 7 9 1 7 9 1 1 3 7 2 9 6 3 3 3 3 4 7 5 9 9 7 6 7 3 3 8 3 5 7 5 9 2 5 4 5 3 9 4 3 3 3 9 1 4 6 1 8 2...
output:
0
result:
ok single line: '0'
Test #6:
score: 25
Accepted
time: 1ms
memory: 3888kb
input:
5 10 3202 5617 52 9188 7503 9 25 6 20 18 55 16 48 19 57 1 3 8 26 18 59 9 29 6 15
output:
25547
result:
ok single line: '25547'
Test #7:
score: 25
Accepted
time: 1ms
memory: 3824kb
input:
100 10 7249 6696 8291 2178 4966 6372 5663 7483 2244 1528 6346 7600 1636 2175 8291 3718 3962 4299 9177 2616 8890 1263 5154 8036 1999 1 2613 5217 4438 9290 383 9573 6983 6256 1280 2734 8534 7894 4887 9075 3880 2478 3554 4960 2080 1894 2589 3390 2562 9627 5735 5831 4491 5879 3529 31 3082 9735 8332 1165...
output:
495399
result:
ok single line: '495399'
Test #8:
score: 25
Accepted
time: 1ms
memory: 3892kb
input:
100 10 1 4294 3150 9075 1 5682 6370 1 8353 1937 4787 3983 1 7783 1 1 6656 1 7938 1 5848 1033 1 462 4205 1 905 1 1 6931 1 1 1 1 6136 1 1 1 1 4813 6903 1 1 8404 2015 2369 1 1 1 1 2108 1 9747 9598 7647 5506 1 21 1532 4552 1 1 1767 1 2298 2463 9139 1 1 1417 1 1 1 1 5350 1 1 9657 1 6642 1 7163 1 5889 745...
output:
262705
result:
ok single line: '262705'
Test #9:
score: 25
Accepted
time: 1ms
memory: 3732kb
input:
10000 10 7990 4121 7489 2039 6446 1109 2820 1 5152 1442 7936 676 5987 8585 7431 8819 1 1743 9743 983 6023 9774 1599 1 3918 3685 5361 9772 7405 2668 7005 9315 2133 4694 7363 2581 6438 5217 2046 6276 4806 1 3508 3229 2397 9552 1321 7919 5537 3407 1 4061 9275 781 6709 5397 1 8243 3297 5799 1163 2205 88...
output:
49785599
result:
ok single line: '49785599'
Test #10:
score: 25
Accepted
time: 1ms
memory: 3872kb
input:
10000 10 6468 3785 6129 7613 7908 5898 6875 7806 1887 9720 7959 3910 1 1743 2737 4273 1065 2818 7209 697 8757 2389 7910 4029 3036 1972 2936 1 8963 9942 2182 8423 8085 8684 2613 1210 9198 6911 4603 1664 5874 1463 1 3694 9163 5705 1481 7338 5747 997 9689 1 1 9782 7701 6168 7897 2775 2945 3035 4502 655...
output:
49879260
result:
ok single line: '49879260'
Subtask #2:
score: 35
Accepted
Test #11:
score: 35
Accepted
time: 7ms
memory: 3780kb
input:
10000 500 2839 6952 5525 6963 8454 8835 6241 6779 6102 4772 4734 4910 4419 5513 9077 6047 7977 5891 7560 9334 8396 5843 6943 4943 7114 7386 2004 82 1956 3289 5935 9631 8974 3047 8480 7495 4887 6884 7759 4552 5656 4321 2748 7417 1942 2258 2140 2217 8975 4888 3191 1589 6498 1943 9617 2005 1178 9970 62...
output:
21300729
result:
ok single line: '21300729'
Test #12:
score: 35
Accepted
time: 7ms
memory: 3928kb
input:
10000 500 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10...
output:
49999500
result:
ok single line: '49999500'
Test #13:
score: 35
Accepted
time: 7ms
memory: 3924kb
input:
10000 500 825 489 640 822 359 834 333 45 484 101 107 569 562 555 41 267 970 878 347 409 322 907 286 717 586 163 661 987 907 845 408 912 641 682 603 721 193 169 599 740 691 619 538 428 995 731 658 492 267 487 87 667 326 89 726 420 536 654 372 588 829 163 707 946 267 90 514 678 459 60 708 308 715 2 96...
output:
0
result:
ok single line: '0'
Test #14:
score: 35
Accepted
time: 3ms
memory: 3872kb
input:
10000 500 1 1 1 1 1 1 7725 5131 1 1 1 1 1 9297 8440 1 1 1 7388 1 3085 1 1 1 7405 1 4596 1 8323 1 1 1 5719 5624 1 1 1 1 1 7208 1 2998 1 1 1 1 1 1 1 7936 1 1 5322 1 1 1 3520 1 1 1 1 1 1 1 1 1122 6501 6409 1 1 2255 1 1 1 1 1 1 1 1 3707 1 1 6656 1 1 1 1 1 1 8332 1 1 4489 1 1 1 1 1 1 4687 1 1 1 2448 1 1 ...
output:
16537203
result:
ok single line: '16537203'
Test #15:
score: 35
Accepted
time: 7ms
memory: 3816kb
input:
10000 500 1 1 1 1 1 1 1 1 2439 1 1 1 1 6492 1 3685 1 1 1 1 1 3652 1 1 1 6769 1 1 1 6702 1 8648 1 1 1 1 1 1 1 1 1 3764 1 1 5042 9499 7311 2491 1 1 1 1 1 6853 1 1 1 5888 1 1 1 1 1 1 1 1 8272 7987 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7111 1 1 1 1 3295 4191 1 1 1 1 1 1 1 1 3469 1 1 1 1 1 1 61...
output:
16149287
result:
ok single line: '16149287'
Test #16:
score: 35
Accepted
time: 3ms
memory: 3768kb
input:
1000 500 1 1 1 1 8974 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6189 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3139 ...
output:
103089
result:
ok single line: '103089'
Test #17:
score: 35
Accepted
time: 6ms
memory: 3796kb
input:
10000 400 1 1 1 6052 1 1 3692 1 1 3138 1 1 4253 1 1 1 1 1 1 1 1 1 1 1 1 3576 1 1 1 1 8306 3056 5462 7597 1 1 1 6258 1 1 4199 1 8119 1 1 9775 1 1 1 1 1 9543 1 1 1 1 1 1 1 1 7876 1 1 1 1 1 1 1 8383 1 1 1 1 1 1 1 1 1 1 3317 1 1 1 1 6517 1 1 1 1 1 1 1 1 1 1 1 4096 1 3375 1 1 1 1 1 1 6182 1 1 2400 1 9250...
output:
12014025
result:
ok single line: '12014025'
Test #18:
score: 35
Accepted
time: 7ms
memory: 3860kb
input:
10000 500 1 1 1 1 1 1 1 1 1 6217 5714 1 1 1 1 1 5727 9275 1 1 1 1 1 8608 1 8087 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6367 7736 1 1 1 1 1 1 1 1 1 9032 1 1 1 1 1 1 5055 1 1 1 1 1 548 1 1 3086 1 1 1 1 5577 1 1 3294 7570 1 1 8912 1 9288 1 1 1 1 1 1 1 1 1 1 5595 1 3597 1 1 1 1 1 1 1 9978 7914 1 1 1 1 5722 1 1 619...
output:
9973685
result:
ok single line: '9973685'
Test #19:
score: 35
Accepted
time: 6ms
memory: 3748kb
input:
1000 500 1 3277 9420 824 1 1 9550 1 8759 1052 1 1 6319 1 1 1104 7633 1 3860 1 8760 1 1 1399 2975 9951 1 1 3484 7311 1 4262 1 1 8297 1 3679 5452 1 1 1 1 1 2536 2607 1 1 8033 4191 3681 9480 8422 6494 6374 581 5373 1 2812 1 4749 1 5486 4864 1 4093 1 1893 1 1 2543 1775 2650 1 9660 1 7384 1 1541 1 1 1 1 ...
output:
3110339
result:
ok single line: '3110339'
Test #20:
score: 35
Accepted
time: 7ms
memory: 3816kb
input:
10000 500 1 1 1 1 1 1 1 1 1 1 1 1 1 8730 1 1 1 1 1 1 3991 1 1 5872 9993 1 1 2707 1 1 8733 1 9854 1 1 1 1 1 2714 8131 1 6043 5667 1 1 1 2783 1 1 1 1 1 6057 1 1 1 1 1 4713 1 1 1 1 3645 1 1 1 1 1 1 1 5072 3241 1 8802 1 1 6373 1 1 1 1 1 1 1 1 1 1 5437 1 6617 1 1 1 1 1 7526 1 1 1 1 1 5569 1 1 1 1 1 1 1 1...
output:
15598072
result:
ok single line: '15598072'
Subtask #3:
score: 40
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #21:
score: 40
Accepted
time: 4ms
memory: 3860kb
input:
10000 500 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10...
output:
99999999
result:
ok single line: '99999999'
Test #22:
score: 40
Accepted
time: 5ms
memory: 3932kb
input:
10000 500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
0
result:
ok single line: '0'
Test #23:
score: 40
Accepted
time: 5ms
memory: 3864kb
input:
10000 500 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10...
output:
99963537
result:
ok single line: '99963537'
Test #24:
score: 40
Accepted
time: 5ms
memory: 3816kb
input:
10000 500 10000 10000 10000 10000 10000 1 10000 10000 10000 10000 10000 1 10000 1 10000 10000 10000 10000 10000 10000 10000 1 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 1 10000 1 10000 10000 10000 1 10000 10000 10000 10000 10000 10000 10000 10000 ...
output:
81597258
result:
ok single line: '81597258'
Test #25:
score: 40
Accepted
time: 2ms
memory: 3924kb
input:
10000 500 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10...
output:
99986898
result:
ok single line: '99986898'
Test #26:
score: 40
Accepted
time: 5ms
memory: 3872kb
input:
10000 500 1 10000 1 1 1 1 1 1 10000 1 1 1 1 10000 10000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10000 1 1 1 10000 1 1 1 1 1 1 1 1 1 1 10000 1 1 1 1 1 1 10000 1 1 1 10000 1 10000 1 1 10000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10000 1 1 1 1 1 1 1 10000 1 1 1 1 1 ...
output:
14259382
result:
ok single line: '14259382'
Test #27:
score: 40
Accepted
time: 6ms
memory: 3708kb
input:
2014 500 6139 3044 4629 1 6620 1 9206 1 1 2364 5662 6989 5016 1 8524 5297 1 5756 1 5115 4637 2094 8635 8431 1491 9951 1 1 9582 2295 8655 7583 1 5005 1357 4230 8606 1 1 8963 1 7191 6305 1 6875 9868 6580 4109 7069 7708 1 1 1 2284 3950 2207 7903 8927 1 1 1 2020 1 2879 1794 1836 7923 9463 1 2565 6484 50...
output:
8220599
result:
ok single line: '8220599'
Test #28:
score: 40
Accepted
time: 3ms
memory: 3860kb
input:
10000 500 1 1 7534 1 8477 1 8152 1 6809 1 9117 6895 9842 7694 6861 1 1 8720 1 6213 8022 1 5067 1 5074 9819 7810 1 1 1 1 1 1 1 1 5058 7437 7615 1 1 5953 8535 6229 1 9559 7060 7682 9409 9959 6399 1 1 8173 1 9242 6733 6839 1 7687 1 1 9203 1 9347 6932 1 7795 8180 1 6246 1 7201 5039 1 1 1 1 7977 6972 1 6...
output:
37475438
result:
ok single line: '37475438'
Test #29:
score: 40
Accepted
time: 7ms
memory: 3924kb
input:
10000 500 1 6486 8893 8636 1 6217 7165 2603 1 2698 1 3403 3167 7832 4226 5337 2644 4807 2860 4447 9345 1 1 5830 7814 9145 1 8465 5359 4073 8438 8961 5494 1 1 3660 8538 1 8764 9091 1 3515 1 4195 6986 9719 2592 7356 1 3243 8624 7763 6537 5442 6134 5033 8212 5795 5399 3480 3393 1 9896 9451 2668 6034 86...
output:
46830648
result:
ok single line: '46830648'
Test #30:
score: 40
Accepted
time: 7ms
memory: 3940kb
input:
10000 491 1 8693 1 1 1 3817 1 1 1 1 1 8238 1 1 4683 1 1 1 725 1 1 1 1 1 1 1 5004 1 1 1891 1 1 1 9448 1 1 8680 1 1 2692 1 2902 1 1 1 1 1 1 1 2617 5049 9772 1 7116 8689 1 1 1 6593 1 7543 2014 1 1 3634 5613 1 1 1 7354 1 1 6037 1 354 5189 1 1 1 744 1 1 1 4514 1 1 1 1 1 4081 1 1 7037 4015 2314 1 1 1 1 54...
output:
16630076
result:
ok single line: '16630076'
Extra Test:
score: 0
Extra Test Passed