QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#454542 | #531. Game | RaduM | 25 | 824ms | 4084kb | C++20 | 1014b | 2024-06-25 02:32:32 | 2024-06-25 02:32:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int v[100005];
multiset <int> s;
int semn[] = {1, -1};
int main()
{
int n,i,k,t,x,e;
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> k;
for(i = 1; i <= n; i++) cin >> v[i];
while(k--){
t = e = 0;
cin >> x;
for(i = 1; i <= x; i++) s.insert(v[i]);
auto it = s.end();
it--;
t += *it * semn[e];
s.erase(it);
e ^= 1;
for(i = x + 1; i <= n; i++){
auto it = s.end();
it--;
if(*it > v[i]){
t += *it * semn[e];
s.erase(it);
s.insert(v[i]);
}
else t += v[i] * semn[e];
e ^= 1;
}
while(!s.empty()){
auto it = s.end();
it--;
t += *it * semn[e];
s.erase(it);
e ^= 1;
}
cout << t << "\n";
}
return 0;
}
詳細信息
Test #1:
score: 0
Runtime Error
input:
7 4 4 6 7 3 4 7 4 6 3 1 2
output:
result:
Test #2:
score: 0
Runtime Error
input:
10 10 10 1 4 2 8 7 3 3 10 2 10 7 6 8 5 1 4 3 9 2
output:
result:
Test #3:
score: 0
Runtime Error
input:
208 150 125 187 27 147 175 94 72 45 63 192 52 178 44 88 64 184 203 52 89 176 96 141 180 49 83 21 106 92 207 102 152 156 198 89 145 114 78 56 137 90 112 84 197 177 39 29 196 106 63 155 184 33 105 84 48 83 154 17 134 98 207 147 16 10 104 30 12 77 95 189 29 31 61 79 28 50 91 181 10 13 113 154 44 5 3 11...
output:
result:
Test #4:
score: 5
Accepted
time: 1ms
memory: 3648kb
input:
540 26 52 170 275 477 413 99 417 427 104 32 198 102 23 67 178 152 43 434 251 394 281 97 85 66 313 79 373 462 340 477 461 418 214 379 152 349 2 255 106 168 444 241 32 56 320 464 59 269 65 475 178 98 534 144 320 330 211 143 313 140 87 44 458 309 73 126 307 41 307 348 306 523 454 347 265 307 393 214 61...
output:
268 286 -1466 1680 -1296 268 -1128 -1214 -1178 1522 1890 1788 774 -1358 -1042 1724 -1244 -1308 100 268 212 -1042 268 1020 1644 1746
result:
ok 26 lines
Test #5:
score: 5
Accepted
time: 3ms
memory: 3572kb
input:
542 251 369 463 53 164 490 18 144 87 488 289 501 72 308 115 164 281 204 456 179 439 332 395 342 340 121 192 87 487 493 13 222 129 361 457 286 6 369 306 209 488 464 530 374 364 171 490 292 181 443 343 256 311 505 358 472 193 27 424 25 42 462 261 358 440 311 370 15 168 27 178 511 140 188 265 440 20 18...
output:
518 -194 -88 -2326 -2318 4 74 1622 518 -704 88 314 -2174 0 -210 82 -286 1064 426 858 1454 -324 148 526 -1472 2892 464 -124 -560 868 706 778 2712 254 578 -428 -2118 590 22 -2046 222 436 -216 -124 -598 -288 -186 550 4 1334 784 868 488 -184 -36 -336 862 -14 -170 1140 -28 72 -2242 -830 286 2356 544 -223...
result:
ok 251 lines
Test #6:
score: 0
Runtime Error
input:
600 600 340 371 504 42 128 427 573 233 200 242 413 9 471 104 512 31 133 480 596 481 317 599 433 450 485 358 303 315 255 281 372 127 450 198 182 156 146 117 7 473 212 530 390 5 365 372 46 80 589 264 467 539 58 204 424 564 207 87 517 181 68 346 596 556 432 552 139 324 428 550 232 235 529 288 103 378 4...
output:
result:
Test #7:
score: 0
Runtime Error
input:
3646 741 1632 1042 1349 950 1312 1706 1640 2509 111 2065 1226 3584 3258 2561 547 2269 1028 760 451 3546 3091 1556 3055 174 1986 2618 307 2510 1226 1884 3043 952 3521 2933 2699 3473 575 1606 739 189 1262 3312 3587 3619 826 3103 2342 1421 2800 2223 3271 1595 1095 1938 413 1623 1076 1194 2964 3036 3141...
output:
result:
Test #8:
score: 5
Accepted
time: 200ms
memory: 3888kb
input:
4769 584 4614 4214 1529 1987 1775 4543 601 2178 1328 3930 3512 425 759 1897 4512 640 4734 3665 2896 1117 2448 2087 896 1091 1353 2865 1866 3384 2427 2114 3292 3728 929 4607 826 3374 228 22 329 4696 533 1662 1256 2486 1195 4536 2758 4496 591 2809 3245 470 4165 999 1257 181 3632 3016 3909 4756 4047 10...
output:
-89488 66252 -6924 -25866 -47060 -125582 1696 2788 -96498 -117952 41540 -26710 2376 -115268 -10558 2946 2506 2738 -506 12474 -70914 93654 17226 4616 2912 -59520 -24080 -11484 24484 93770 3056 2026 7128 70906 2838 2412 107064 -90292 -89304 -95968 12780 93682 1268 1744 1976 84642 12088 92630 45698 751...
result:
ok 584 lines
Test #9:
score: 5
Accepted
time: 675ms
memory: 4084kb
input:
8692 977 2678 1481 4286 107 6908 7977 3115 4154 3742 7033 1699 1189 8293 3453 3792 4073 4921 2069 4563 7107 4367 4481 7084 604 6398 1766 3502 5487 5306 1162 1527 1068 7943 3243 1911 2067 1305 5550 1553 4165 4213 7894 6127 7108 1151 7721 1529 3689 592 1197 4818 364 2969 2581 4204 1349 6662 2179 589 8...
output:
25387 -1781 -1101 69857 104993 -28641 5109 31559 10497 -7635 -89851 -2081 -38891 6471 30325 4633 4371 74649 -447 -100229 34657 -33739 103825 3931 23401 -41251 47 19509 -3607 37917 10993 92511 102047 -102675 27421 73543 -62585 57959 -94493 38773 10513 -5093 10293 78767 106469 106835 -28011 4693 39951...
result:
ok 977 lines
Test #10:
score: 5
Accepted
time: 824ms
memory: 4068kb
input:
10000 1000 6960 5914 1055 2108 8306 566 9218 1023 6675 4653 4082 3332 9502 8501 6399 3247 5518 4224 8501 1702 5533 1416 9735 3338 1484 8634 8301 1922 4154 6938 1669 8026 6137 7649 3515 2895 4637 1602 8261 7629 1010 9776 4873 9353 8448 4065 2584 8083 5718 7161 1735 1989 5811 4740 3447 6511 7928 9506 ...
output:
36688 -189250 78954 -7568 -15856 191646 -105128 -89714 49150 -118558 4516 -23592 -205082 -78086 5652 122692 -10 6292 4820 -346206 -2940 2344 -85988 -3254 60680 43682 64334 -50796 83066 -110558 5058 5408 4566 -47156 212210 -43640 -190536 -181046 -3202 197174 43754 20998 -170484 -345140 -85230 93966 -...
result:
ok 1000 lines
Test #11:
score: 0
Time Limit Exceeded
input:
55611 668 46800 1695 50620 44613 1154 18115 50995 3389 22909 11534 35539 51505 39607 11955 25862 29524 55592 29742 30506 13219 17133 30478 13930 41617 29264 29638 8641 41537 29499 14196 21678 41371 36070 13117 54355 41185 17737 43443 6948 37969 49903 49328 29605 44556 35661 12680 35633 16127 11318 5...
output:
result:
Test #12:
score: 0
Time Limit Exceeded
input:
52357 1407 7246 34985 44509 7726 46136 28282 17060 18280 31592 24351 22419 33148 42574 3630 34875 7370 46951 10907 45794 19792 52112 5598 40584 44334 33680 2106 6367 43490 12891 26854 10036 4577 33683 12966 16469 11232 48344 32636 43654 25304 12280 26724 44129 48854 44405 37819 24491 20371 43177 427...
output:
result:
Test #13:
score: 0
Time Limit Exceeded
input:
50777 1005 3338 37282 31313 16624 17881 35902 27416 45991 30084 22711 44836 10954 32398 48698 46304 19678 39531 36928 34073 34734 18538 3020 4857 33709 15894 35988 32182 9561 50174 27323 11547 44506 8905 25308 35585 3132 17495 22526 38897 2881 33782 31339 21873 30342 13220 24646 4271 33489 50012 380...
output:
result:
Test #14:
score: 0
Time Limit Exceeded
input:
83214 1643 60059 14 60054 8 60005 66 60017 23 60074 53 60081 32 60001 1 60098 47 60017 24 60000 2 60032 16 60034 38 60083 34 60000 22 60053 38 60068 26 60036 49 60014 95 60036 2 60060 29 60009 76 60072 53 60047 65 60083 83 60017 61 60034 89 60010 40 60046 11 60027 6 60025 78 60068 24 60019 38 60073 ...
output:
result:
Test #15:
score: 0
Time Limit Exceeded
input:
90373 777 86561 52154 16914 68062 63554 72354 66583 54665 83913 64577 67490 19623 48478 50610 14198 44553 82153 87612 77258 43149 13302 65076 83167 18544 12611 9871 8948 8591 39374 78998 37480 50109 39599 29218 61550 42595 56586 56754 51124 16373 11270 83901 64601 64494 13514 3699 45153 22041 29204 ...
output:
result:
Test #16:
score: 0
Time Limit Exceeded
input:
94887 1017 75083 9965 90777 9423 49901 71161 36513 91887 78575 39609 27620 74307 71293 5317 22529 66351 87452 56887 41064 12607 22909 18520 80613 36943 50806 53164 77626 25461 84713 21109 67437 59187 79386 31806 53493 26680 68864 81224 63613 31662 58038 57795 4853 52219 8456 4391 49630 92081 204 173...
output:
result:
Test #17:
score: 0
Time Limit Exceeded
input:
100000 2000 90029 24 90024 18 90005 26 90007 23 90024 13 90011 22 90011 11 90018 7 90007 14 90000 22 90022 16 90014 28 90013 14 90020 2 90013 28 90008 26 90016 9 90004 5 90026 2 90000 29 90009 26 90012 13 90027 25 90003 13 90007 11 90014 29 90000 10 90016 1 90007 26 90005 8 90028 14 90029 28 90003 2...
output:
result:
Test #18:
score: 0
Time Limit Exceeded
input:
88209 1930 49243 24977 40855 77568 86233 15235 5688 75012 24839 50633 35287 26924 14358 37966 83843 69215 11245 17064 25529 16337 61108 17402 44284 35892 33069 45007 3898 48241 74490 64532 73788 11058 55791 66560 45241 51690 77627 54935 55994 72030 31858 55910 26169 404 29401 27575 5394 51638 78849 ...
output:
result:
Test #19:
score: 0
Time Limit Exceeded
input:
94404 1169 13456 9404 50594 65706 77387 9774 55846 3430 65110 87326 8231 6991 36393 28078 29414 71671 8080 11170 36357 68895 28943 64815 39098 55468 68490 58435 53625 45081 41917 11480 85417 66391 53323 37639 33024 78673 59304 16633 44689 94160 22351 12493 2450 23233 31834 8951 77458 24253 1533 4082...
output:
result:
Test #20:
score: 0
Time Limit Exceeded
input:
100000 2000 46960 15914 21055 72108 48306 80566 49218 81023 76675 44653 94082 53332 59502 78501 76399 13247 95518 14224 58501 51702 5533 71416 89735 93338 21484 88634 38301 91922 24154 56938 61669 88026 6137 37649 33515 22895 4637 61602 28261 17629 31010 29776 4873 39353 58448 74065 42584 78083 3571...