QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#809416 | #3157. IOI Manju | rlc202204 | 35 | 8ms | 3936kb | C++17 | 813b | 2024-12-11 14:57:26 | 2024-12-11 14:57:27 |
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 = m * 2; j >= c[i]; j--)
f[j] = min(f[j], f[j - c[i]] + e[i]);
}
for (int j = m * 2; 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;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 25
Accepted
time: 0ms
memory: 3828kb
input:
1 1 9120 6124 9262
output:
0
result:
ok single line: '0'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 3876kb
input:
1 1 7581 9723 5615
output:
0
result:
wrong answer 1st lines differ - expected: '1966', found: '0'
Subtask #2:
score: 35
Accepted
Test #11:
score: 35
Accepted
time: 8ms
memory: 3860kb
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: 8ms
memory: 3752kb
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: 8ms
memory: 3916kb
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: 8ms
memory: 3796kb
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: 8ms
memory: 3752kb
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: 1ms
memory: 3836kb
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: 3800kb
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: 8ms
memory: 3936kb
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: 1ms
memory: 3780kb
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: 8ms
memory: 3772kb
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: 0
Skipped
Dependency #1:
0%