QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#771173 | #3263. 期末考试 | Grand_Elf | 100 ✓ | 12ms | 9140kb | C++14 | 1.2kb | 2024-11-22 10:23:06 | 2024-11-22 10:23:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, m, tot = 1e5, t[N], b[N];
long long ans = 1e18, A, B, C, ctp[N], stp[N], cbp[N], sbp[N], cbs[N], sbs[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> A >> B >> C >> n >> m;
A = min(A, B);
for (int i = 1; i <= n; i++) {
cin >> t[i];
ctp[t[i]]++;
stp[t[i]] += t[i];
}
for (int i = 1; i <= m; i++) {
cin >> b[i];
cbp[b[i]]++;
sbp[b[i]] += b[i];
cbs[b[i]]++;
sbs[b[i]] += b[i];
}
for (int i = 1; i <= tot; i++) {
cbp[i] += cbp[i - 1];
sbp[i] += sbp[i - 1];
ctp[i] += ctp[i - 1];
stp[i] += stp[i - 1];
}
for (int i = tot; i >= 1; i--) {
cbs[i] += cbs[i + 1];
sbs[i] += sbs[i + 1];
}
for (int i = 1; i <= tot; i++) {
long long a = cbp[i] * i - sbp[i];
long long b = sbs[i] - cbs[i] * i;
long long c = ctp[i] * i - stp[i];
if (C >= (long long)1e16 && c > 0) {
continue;
}
ans = min(ans, min(a, b) * A + max(b - a, 0ll) * B + c * C);
}
cout << ans << '\n';
return 0;
}
詳細信息
Pretests
Final Tests
Test #1:
score: 5
Accepted
time: 0ms
memory: 8256kb
input:
1000000000 1000000000 98 1900 2000 367 1321 752 416 271 1408 1837 152 906 1840 103 429 1900 323 1659 1323 564 1477 955 1472 296 328 1342 1616 591 769 637 1041 1301 1208 1272 1904 1642 1340 1439 11 307 365 1850 85 232 496 194 1030 756 367 661 1528 665 134 598 1083 1497 1799 266 1665 1790 39 524 1859 ...
output:
186897662
result:
ok single line: '186897662'
Test #2:
score: 5
Accepted
time: 0ms
memory: 8516kb
input:
1000000000 1000000000 77 1900 2000 1295 1102 359 612 492 102 505 663 287 53 986 1975 1317 265 1792 1339 1039 756 1605 1037 1729 412 1688 270 1972 1450 843 306 1396 1419 1206 800 1746 1906 1779 1555 1363 980 912 1259 1823 1754 1328 365 1763 1907 922 79 1247 95 1848 333 537 805 842 727 681 1614 1265 8...
output:
142833691
result:
ok single line: '142833691'
Test #3:
score: 5
Accepted
time: 2ms
memory: 8456kb
input:
73 1000000000 77 2000 2000 1139 1787 1341 641 817 338 1914 1447 579 1402 512 1185 334 1128 744 1267 764 1586 1389 1174 763 1124 1521 1096 1454 365 166 1434 1498 1119 614 1649 362 978 540 245 220 865 1033 868 946 1883 1664 656 562 1907 1017 93 742 577 658 996 973 1695 1529 3 1064 1661 1683 1947 654 1...
output:
76307722
result:
ok single line: '76307722'
Test #4:
score: 5
Accepted
time: 2ms
memory: 8324kb
input:
81 1000000000 54 2000 2000 1477 1920 1512 1649 1155 1148 422 1125 137 852 996 200 673 847 1824 1956 314 1177 1528 997 1909 848 321 638 665 1544 468 961 1359 1000 12 1946 1334 1691 313 645 688 704 1439 51 1540 1627 1800 602 1786 1233 1790 1474 946 1504 66 1016 493 1909 376 30 242 1571 1912 201 523 72...
output:
62775405
result:
ok single line: '62775405'
Test #5:
score: 5
Accepted
time: 2ms
memory: 8272kb
input:
74 70 88 2000 2000 1762 740 261 1962 1486 273 251 112 460 1669 481 189 1649 1218 1917 724 1684 1132 1337 1357 834 780 803 1730 1436 848 1086 1155 116 1928 528 626 19 843 1458 184 1750 1200 1923 1838 380 326 1733 5 314 700 799 623 471 1721 1273 1763 272 53 1091 1085 101 1454 1118 1979 1594 901 337 17...
output:
79750984
result:
ok single line: '79750984'
Test #6:
score: 5
Accepted
time: 0ms
memory: 8384kb
input:
64 54 60 2000 2000 1765 367 305 301 1219 277 1274 1124 185 1679 1191 1662 415 439 1022 617 1005 1099 987 292 1776 349 1070 1332 1289 99 1128 337 1341 999 515 1734 1014 1239 871 20 848 1366 1525 31 237 1978 1568 1615 1474 652 191 657 504 667 1053 1684 427 1417 169 557 926 220 1191 659 1798 926 924 19...
output:
55965756
result:
ok single line: '55965756'
Test #7:
score: 5
Accepted
time: 2ms
memory: 8320kb
input:
77 67 95 2000 2000 220 853 1634 1087 805 1159 797 1502 250 1067 1663 941 734 611 1653 1099 744 456 991 1784 770 1909 1139 1323 1019 250 777 1836 502 1386 588 155 569 893 527 120 735 1343 1142 296 774 319 457 711 818 1905 949 208 1256 76 202 1431 468 61 1694 1055 1251 899 1896 1572 730 672 1638 67 13...
output:
79686452
result:
ok single line: '79686452'
Test #8:
score: 5
Accepted
time: 3ms
memory: 8392kb
input:
50 40 87 2000 2000 1208 282 448 770 1731 20 668 310 1892 948 1203 1653 374 1357 515 579 666 1474 1948 1011 112 1131 1972 1266 1298 517 117 1980 458 542 42 1140 1703 253 213 833 1772 1512 828 1691 1889 699 1031 914 112 952 996 584 1145 354 1012 1138 1598 448 139 1498 920 1345 1859 160 944 1634 218 12...
output:
55114803
result:
ok single line: '55114803'
Test #9:
score: 5
Accepted
time: 3ms
memory: 8260kb
input:
69 77 100 2000 2000 1393 1802 1452 825 994 1961 1834 973 1654 1954 1901 783 795 1150 660 635 495 1787 1473 512 775 170 665 1808 683 1583 86 1651 152 1141 1016 1924 1997 1671 559 1554 926 840 851 113 1461 1564 381 279 875 157 171 1327 1123 727 1664 185 1376 1467 1729 1608 442 1696 393 1570 1838 61 12...
output:
82862175
result:
ok single line: '82862175'
Test #10:
score: 5
Accepted
time: 0ms
memory: 8316kb
input:
20 97 88 2000 2000 1236 604 418 1932 726 1316 299 631 361 1944 1033 1677 170 1921 1285 1567 686 317 1053 85 829 507 99 74 850 992 445 604 717 1189 1219 349 753 1622 1477 500 134 260 355 61 888 692 322 373 1174 1983 1710 303 1396 160 418 1 297 1273 1041 999 1410 206 1105 911 1901 280 1723 476 655 979...
output:
53300433
result:
ok single line: '53300433'
Test #11:
score: 5
Accepted
time: 2ms
memory: 8252kb
input:
71 78 97 2000 2000 1519 844 1996 1237 1642 1136 1415 1062 1184 1256 610 1232 1853 22 955 1268 864 1740 1922 873 1755 196 1501 153 902 1129 1205 753 237 1500 72 1269 1757 159 485 1561 907 1581 659 473 1021 720 1722 1730 1326 1450 1687 1766 1422 861 1501 957 272 1827 783 1663 299 390 1607 1402 138 199...
output:
83989352
result:
ok single line: '83989352'
Test #12:
score: 5
Accepted
time: 3ms
memory: 8336kb
input:
65 74 84 2000 2000 1802 50 651 1450 801 1513 650 1791 741 1561 740 145 1010 1732 1176 1524 907 1216 233 1889 1380 231 206 100 119 936 227 557 1024 1972 823 1648 1265 593 332 1509 703 1083 1963 1736 1394 1742 1885 1242 793 1005 82 958 820 1806 1582 13 1928 556 791 387 575 324 1017 1295 693 1704 1682 ...
output:
75329616
result:
ok single line: '75329616'
Test #13:
score: 5
Accepted
time: 8ms
memory: 9136kb
input:
18782 28721 10000000000000000 100000 100000 42982 80606 85180 68071 99046 65268 48510 73536 60440 84543 44394 46358 46034 90275 57265 47971 63869 55460 99090 90299 52733 60929 54080 46181 78640 56766 38019 99455 93024 84234 95444 39254 45732 44130 95972 77164 61018 38270 44419 75102 54177 65089 6481...
output:
48453351050813
result:
ok single line: '48453351050813'
Test #14:
score: 5
Accepted
time: 12ms
memory: 9076kb
input:
6756 37718 10000000000000000 100000 100000 88579 43774 82699 69547 65565 82900 58880 41884 58472 79940 84355 48406 66768 40308 49191 70304 60366 71350 99343 58943 70818 94084 47864 94673 72541 43991 91683 40223 98943 46857 71648 66672 42994 88992 38196 97228 69213 89228 63744 48247 80970 45669 74812...
output:
54968709953224
result:
ok single line: '54968709953224'
Test #15:
score: 5
Accepted
time: 8ms
memory: 9080kb
input:
35681 47681 67898 100000 100000 25780 62515 36528 18275 2276 79792 63939 43576 74190 64161 2682 42753 3094 99071 83052 70842 52102 20426 23508 83844 50283 79426 80881 61314 42551 5998 82726 91613 4958 79769 93531 83745 21849 50736 73434 38653 91814 39973 34514 13479 26533 57615 61496 16982 51773 169...
output:
128090546746587
result:
ok single line: '128090546746587'
Test #16:
score: 5
Accepted
time: 12ms
memory: 9048kb
input:
25580 67212 87318 100000 100000 97883 19948 53781 19835 15523 56427 74842 97135 19905 88936 18848 42354 40030 8480 26340 92708 96487 79796 87012 89066 67021 93740 14435 9132 46565 50960 59209 60629 81416 22161 27520 99607 38901 67742 61304 11140 25131 47343 32675 91318 24303 97662 81818 13255 78060 ...
output:
140464062159024
result:
ok single line: '140464062159024'
Test #17:
score: 5
Accepted
time: 8ms
memory: 9136kb
input:
35601 70110 77621 100000 100000 8623 8666 36455 9719 62449 14701 76514 79434 92216 59196 81532 82071 34440 90332 17192 59063 44068 80104 94045 21445 67830 98718 16694 45633 40491 93631 40082 79696 50837 69075 31060 42137 59943 32227 6787 33385 26909 12957 85387 42128 55889 21812 54683 46146 56775 77...
output:
141805531593949
result:
ok single line: '141805531593949'
Test #18:
score: 5
Accepted
time: 8ms
memory: 9140kb
input:
45681 57112 78782 100000 100000 75429 30352 22984 11750 21566 19333 37043 73606 58347 20312 98662 87072 44869 74970 66605 54083 52042 28890 92278 68292 37658 31793 46677 93756 87580 73431 3649 33766 4343 25226 91893 61090 65049 13326 91696 12309 83220 20552 53845 68487 3356 29122 20652 995 53162 234...
output:
154104302149009
result:
ok single line: '154104302149009'
Test #19:
score: 5
Accepted
time: 9ms
memory: 9012kb
input:
3568 61200 66512 100000 100000 76871 57641 39147 8474 74331 97435 51551 96143 76143 27587 85141 2994 72342 5354 9107 63598 27596 82014 13221 22005 67531 73746 36985 5497 75127 6555 37635 90068 44659 30100 56250 17281 2442 20955 22169 54848 74407 73746 12415 91926 74524 48638 92303 91786 4095 42124 1...
output:
86949558217712
result:
ok single line: '86949558217712'
Test #20:
score: 5
Accepted
time: 10ms
memory: 9080kb
input:
40000 77100 78710 100000 100000 20575 70295 59734 17082 47409 98056 68169 24850 97204 335 5290 64704 21131 52475 40864 3975 27999 53603 30003 78124 73916 43295 8051 37276 2674 79341 24178 32326 29044 74254 41925 16157 42236 88838 75366 98615 78949 38815 26293 52848 47376 51398 62546 32680 78784 2788...
output:
148500604264660
result:
ok single line: '148500604264660'
Extra Test:
score: 0
Extra Test Passed