QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#691809 | #9483. Maximize Array | Tggdb# | TL | 1967ms | 9132kb | C++20 | 815b | 2024-10-31 13:04:21 | 2024-10-31 13:04:21 |
Judging History
answer
#include<vector>
#include<stdio.h>
#include<iostream>
#include<algorithm>
#define inf 0X7fffffff
using namespace std;
const int N=2e6+9;
int read(int &x){
int dat=0,oko=1;char chc=getchar();
while(chc<'0'||chc>'9'){if(chc=='-')oko=-1;chc=getchar();}
while(chc>='0'&&chc<='9'){dat=dat*10+chc-'0';chc=getchar();}
x=dat*oko;return x;
}int n,k,a[N],del[N],mx;
int main(){
read(n),read(k);
for(int i=1;i<=n;i++){read(a[i]);}
for(int i=1;i<=n;i++){
if(del[i])continue;mx=i;
for(int j=i+k;j<=n;j+=k){
if(del[j])continue;
if(a[j]>a[mx])mx=j;
}for(int j=i;j<mx;j++)del[j]=true;
}for(int i=1;i<=n;i++){
if(del[i])continue;
printf("%d ",a[i]);
}
printf("\n");return 0;
}
/*
5
3
1 2 3 4 5
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5880kb
input:
9 3 1 2 3 4 1 2 3 4 1
output:
4 4 1
result:
ok 3 tokens
Test #2:
score: 0
Accepted
time: 0ms
memory: 5880kb
input:
6 1 1 6 4 2 3 5
output:
6 5
result:
ok 2 tokens
Test #3:
score: 0
Accepted
time: 0ms
memory: 5992kb
input:
6 5 6 5 4 3 2 1
output:
6 5 4 3 2 1
result:
ok 6 tokens
Test #4:
score: 0
Accepted
time: 0ms
memory: 6004kb
input:
1392 5 915 798 656 1252 1170 691 1298 205 254 1334 622 1090 1081 617 365 477 362 1306 35 432 744 144 1277 259 80 410 317 983 916 1089 700 1030 135 156 1102 945 1021 63 251 1173 485 1261 1305 219 1190 151 142 288 795 984 1324 417 1235 1295 374 1091 434 596 553 1298 244 1179 115 767 973 315 603 180 10...
output:
1385 1386 1388 1296 1065 1332 1139 288 828 749 1214 1089
result:
ok 12 tokens
Test #5:
score: 0
Accepted
time: 0ms
memory: 5876kb
input:
1235 294 496 705 855 832 681 885 857 35 617 356 164 22 982 1095 448 671 532 600 906 781 328 288 424 1162 505 170 804 1131 856 658 151 636 828 876 892 293 302 63 846 1140 528 1231 332 910 458 1208 481 1107 1121 928 579 1061 465 633 1171 1044 983 62 40 707 573 899 967 416 1208 31 1187 119 1035 1180 30...
output:
1057 731 575 815 1094 1051 979 737 338 100 236 125 1185 163 265 336 1 953 716 258 378 494 1131 539 771 762 377 52 332 463 1079 1217 937 425 1106 584 218 761 658 1124 428 1158 1213 506 978 181 95 380 704 458 346 1004 371 582 260 569 64 181 4
result:
ok 59 tokens
Test #6:
score: 0
Accepted
time: 1ms
memory: 5968kb
input:
1731 3 1304 1034 1285 402 1110 691 1544 1520 57 657 860 806 278 539 112 347 323 1170 757 769 841 1364 412 68 596 11 654 1523 1536 87 59 644 1165 1421 1095 796 684 463 769 296 409 1510 1595 645 1260 115 939 1054 857 89 1660 1473 355 1586 1219 1375 673 909 430 246 1273 497 955 1408 1593 1475 142 315 1...
output:
1731 1728 1722 1731 1722 1709 1455 1211 1215
result:
ok 9 tokens
Test #7:
score: 0
Accepted
time: 1ms
memory: 5888kb
input:
1176 4 277 1016 570 780 509 107 308 302 621 653 942 824 935 268 157 38 125 483 345 437 198 591 216 975 221 1084 89 1086 229 982 565 89 756 1159 401 151 362 702 49 1161 874 89 648 435 704 713 7 8 170 1061 1035 273 171 56 947 755 681 1030 680 652 1039 368 805 847 433 714 1068 1104 137 785 928 22 497 3...
output:
1170 1174 1175 853 763 1005 512 716
result:
ok 8 tokens
Test #8:
score: 0
Accepted
time: 1ms
memory: 5880kb
input:
1203 188 597 1061 959 940 742 1186 832 336 1023 1029 915 1006 839 448 239 22 415 1109 214 840 870 637 878 423 592 796 1159 856 26 1079 83 1071 653 857 470 329 69 721 265 1085 1000 139 978 301 501 890 167 1009 554 1138 341 97 187 1081 140 813 343 708 1088 175 223 633 10 1173 150 324 964 45 1071 203 4...
output:
1016 1127 1180 1131 997 1042 436 771 1004 475 715 280 161 217 1087 122 427 534 772 1127 863 972 618 956 461 593 837 155 110 719 606 652 1155 756 438 1074 197 755 590 642 682 799 696 768 486 257 21 911 605 95 429 244 1150 1119 828 412 378 668 1080 583 882 276 1137 991 464 445 22 872 1114 856 320 275 ...
result:
ok 75 tokens
Test #9:
score: 0
Accepted
time: 8ms
memory: 7008kb
input:
292698 7988 38966 51135 180900 142779 200531 16032 97627 4255 139157 272333 247330 46654 147980 129717 56541 99997 114424 281779 142869 285322 120906 3166 37893 110895 287423 104300 251540 42149 183273 39833 70543 172743 91359 41122 201955 89642 66677 238846 221199 118614 115464 154333 173145 270965...
output:
285283 205274 55516 277203 214606 38546 290836 70250 20359 261937 62240 221392 225355 11986 184572 250960 194401 98596 214785 85047 236821 100729 206002 140956 281157 209549 28779 113441 12657 174757 160898 121707 131549 98390 226701 105359 52503 4258 136955 245411 114497 48625 181371 106661 155342 ...
result:
ok 5130 tokens
Test #10:
score: 0
Accepted
time: 4ms
memory: 6988kb
input:
291303 6 265139 260987 49817 234725 69742 218237 8480 50119 4566 98039 156829 237292 6975 289521 24992 132135 34712 125564 116315 195098 105855 78338 62166 248028 37677 170952 245323 14102 256685 233124 106400 287252 232105 193020 126840 212703 76342 48522 290794 182463 72782 106077 195627 5884 2287...
output:
291297 291300 291299 291301 291285 291220 266660 164522 130099
result:
ok 9 tokens
Test #11:
score: 0
Accepted
time: 13ms
memory: 8652kb
input:
291907 99403 135674 5812 210570 282043 56390 69747 35706 215210 55795 41977 264489 195878 131625 46941 25418 964 186415 267887 195414 206579 201602 148232 123995 141396 229074 280783 290425 232983 18329 193974 165947 43971 147681 43903 86138 212253 146789 37288 123539 173120 144757 245313 55867 2079...
output:
281769 266373 218744 252969 131803 44727 203393 7923 192979 250436 44593 170444 267950 66076 285334 263863 97196 104799 180490 73298 81944 263994 13808 174006 226092 82563 165316 77562 184027 206114 244140 291740 192346 107450 180926 108466 140735 27537 75107 156922 119200 157603 8260 126891 229895 ...
result:
ok 93101 tokens
Test #12:
score: 0
Accepted
time: 9ms
memory: 7028kb
input:
299677 6 261062 13439 136726 22592 101200 47981 21344 195972 105056 193700 144991 23089 214074 226411 123367 167914 261933 275171 245854 45847 31390 122896 262727 259940 187032 154188 162139 9754 52110 184554 10164 7036 275626 123225 157904 45801 95762 18391 228166 89574 242130 17399 224474 72032 28...
output:
299675 299670 299618 299602 299551 299593 299484 298913 298057 298060 291964 238000 279017
result:
ok 13 tokens
Test #13:
score: 0
Accepted
time: 9ms
memory: 9084kb
input:
297106 7 40936 187771 170679 293463 175060 140924 153981 53805 241999 249810 126488 39070 296424 121591 99881 95651 31911 254032 54230 119979 95618 251871 190191 140273 235621 267207 290382 232243 50476 202616 45787 126724 57066 83493 199396 238198 216906 23469 3409 46919 51538 292382 67957 255292 2...
output:
297105 297097 296888 296490 296761 293931 275941 277234 258977 284898 235240 120070 222948 74199 153204 90526 276230 230020 43894
result:
ok 19 tokens
Test #14:
score: 0
Accepted
time: 9ms
memory: 7008kb
input:
290785 944 32924 113386 171949 272508 122819 2845 190352 100062 167243 290075 172127 161008 85814 213822 166900 7715 120780 148939 26193 60913 258901 282445 167409 21137 49940 246549 282095 32403 227841 98072 275473 56496 39706 261569 288147 123629 176500 116660 194990 111841 118239 170967 49343 106...
output:
290779 284815 258293 78341 247726 125617 120060 85993 8631 285533 165152 104076 63783 36553 46308 234310 188112 186335 211650 128028 282908 249606 130409 89898 149967 263076 87811 250301 29578 187168 71626 62355 93062
result:
ok 33 tokens
Test #15:
score: 0
Accepted
time: 9ms
memory: 8996kb
input:
291795 39401 256425 106921 118174 276074 121223 196905 200867 147938 33882 248779 15970 12063 278685 172506 146404 111360 287628 161203 264071 234739 271997 176123 21340 98384 165814 51369 286308 195081 217186 254410 155594 30701 133358 95596 145358 79679 202575 112060 159300 58497 2442 122612 22983...
output:
256425 275853 278785 213768 79782 178637 287612 194352 280084 171747 143383 44654 10663 126880 115004 255724 217314 219399 201598 23514 127232 103766 62036 113630 227781 285148 32266 183772 197693 94470 85350 55380 123863 77766 122351 3812 18311 146572 104753 39862 192538 115628 289104 263780 189896...
result:
ok 15988 tokens
Test #16:
score: 0
Accepted
time: 9ms
memory: 9132kb
input:
298952 7165 98696 135828 269666 151690 62816 216807 107821 136300 88638 191874 22017 296807 76825 260933 186984 252590 294878 225867 225389 150025 245255 215610 90369 142698 270917 238488 45155 2369 96823 4948 187965 116150 227165 122465 27100 57317 199223 127022 92535 75604 80419 116415 12479 53288...
output:
295549 278682 275359 243749 36617 253642 20703 147125 290113 61962 64438 172879 201015 258427 291349 199194 5562 181021 93745 210939 56165 12208 191945 230850 219022 140109 255941 296788 278039 281446 19967 286404 191606 62041 120076 192161 176894 187438 179903 258891 161592 69098 26110 13099 292337...
result:
ok 5187 tokens
Test #17:
score: 0
Accepted
time: 9ms
memory: 9024kb
input:
296092 29 99390 69522 162849 246204 86902 71452 201864 105431 78788 155706 215885 241564 272611 238234 179147 230062 113232 88643 112412 154865 238873 33462 292353 219772 253353 115897 205969 259679 84176 290316 251685 236759 190130 201964 76555 162509 261765 277167 196074 121798 266693 165833 14730...
output:
296055 296082 291775 278179 293826 293366 290605 274975 206917 191539 223150 142009 139513 86838 59188 137061 255900 166840 190863 241574 236218 121489 110402 68103 57537 102510 160174 187528 281535 261651 1053
result:
ok 31 tokens
Test #18:
score: 0
Accepted
time: 8ms
memory: 6992kb
input:
299253 6499 140130 96110 208818 293711 101740 116400 128673 283373 282817 280105 141691 163411 77956 197841 140743 13818 192615 69182 75772 123631 274449 271504 11512 277407 170395 142533 5463 123301 110930 279511 267123 29714 216292 266340 102885 88122 66666 203187 31871 95187 167412 196507 297015 ...
output:
285360 289426 165928 216916 122874 215816 25274 98397 213683 79958 283093 182774 139637 16034 218133 155846 205362 296643 224338 83470 201732 24261 96713 263131 157131 272291 8343 52440 170456 34090 237678 214512 62412 280875 139881 219533 168949 156571 178068 233970 269732 192752 269685 233822 1197...
result:
ok 299 tokens
Test #19:
score: 0
Accepted
time: 10ms
memory: 7048kb
input:
299514 11 201413 271984 83174 25778 294445 147547 34371 26968 3518 5954 12696 101083 184545 285312 165849 89017 155002 215182 157026 56461 88330 220294 73538 184876 127572 188738 180015 193031 112186 206225 294867 250338 84908 203371 241505 132411 292821 161903 256250 70903 71822 98796 132633 12362 ...
output:
298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 298621 295352 296779 297155 295545 295545 189361 264415 99078 232027 282057 3069 71383
result:
ok 39 tokens
Test #20:
score: 0
Accepted
time: 12ms
memory: 9104kb
input:
299148 6 279827 34873 145767 239892 299124 207794 76802 51282 297159 233994 176399 79073 21101 176914 166087 225713 136359 190147 236855 49759 101114 218416 297120 281858 104734 186157 152303 30054 163511 150489 285270 36018 228895 75621 207862 237270 57515 248857 97765 152250 183977 245347 248514 1...
output:
299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124 299124...
result:
ok 66 tokens
Test #21:
score: 0
Accepted
time: 31ms
memory: 7000kb
input:
299313 3 281295 155548 88808 5117 254661 25148 247722 218649 96122 277657 63998 161136 21350 149123 241425 197090 60988 15200 241425 285052 242479 277657 189168 298981 119595 11105 196226 31474 215849 7259 251905 296056 216738 47457 196226 215374 96412 162958 200461 290960 81285 306 101472 13966 412...
output:
299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116 299116...
result:
ok 105 tokens
Test #22:
score: 0
Accepted
time: 62ms
memory: 9096kb
input:
299487 2 268767 89879 93970 5144 229235 222743 27777 269688 168200 88861 166438 93216 94566 25449 85602 7030 245235 293274 107152 91102 71611 185786 65783 89292 87489 177390 131506 174718 279466 91460 100056 229252 15592 229212 47473 66279 36185 177877 14704 100056 64588 197279 229999 201262 43193 2...
output:
298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866 298866...
result:
ok 189 tokens
Test #23:
score: 0
Accepted
time: 222ms
memory: 7040kb
input:
299998 1 136488 74793 129484 127064 8906 20407 69071 84005 63609 115244 156837 8713 16047 272669 112703 292981 143157 21006 191296 20139 268254 226940 206717 212130 13321 182397 129484 87020 128367 156178 117994 98878 255032 201 68982 231304 185231 148933 284773 11175 227378 45556 204743 273226 8576...
output:
299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726 299726...
result:
ok 308 tokens
Test #24:
score: 0
Accepted
time: 27ms
memory: 9044kb
input:
299108 9 54151 102121 241179 250126 272209 109511 216513 217350 29719 126875 212185 215313 272209 217350 11010 4557 277662 95321 252566 246617 4557 292380 274066 161832 102121 197375 162757 102121 161832 218940 11010 280671 257496 277662 217350 186570 44331 121643 210443 241179 215313 230273 27873 2...
output:
299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015 299015...
result:
ok 317 tokens
Test #25:
score: 0
Accepted
time: 81ms
memory: 9028kb
input:
299394 5 47584 5744 100663 238332 247552 179636 126806 241163 2897 211472 68677 65085 17187 247552 211472 238332 134231 173544 209917 6197 234904 186430 249582 224762 139540 215643 88467 273071 153169 272000 99277 126806 295862 102727 32702 197964 65085 219397 281969 38363 236195 88467 36026 236195 ...
output:
295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862 295862...
result:
ok 574 tokens
Test #26:
score: 0
Accepted
time: 260ms
memory: 9104kb
input:
299150 3 289570 163895 56341 222261 177192 118909 209371 85880 9997 284460 295202 40034 95881 65253 88956 126680 275164 275664 48268 198292 40034 56341 65253 40034 185117 137641 115639 295202 5417 56341 191443 189698 118909 209371 124823 191443 25366 56264 57552 145200 101876 177192 224172 65672 958...
output:
295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202 295202...
result:
ok 1133 tokens
Test #27:
score: 0
Accepted
time: 554ms
memory: 9020kb
input:
299470 2 219375 138367 17880 54568 172399 213007 117442 222881 98126 100803 286879 43671 214432 172399 88659 266228 276047 219375 5724 154766 212027 213007 100803 294998 276047 134353 104378 172399 236802 286879 259730 237358 267922 5724 194151 100803 235313 217864 11084 73894 294998 77251 154766 21...
output:
295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785 295785...
result:
ok 1628 tokens
Test #28:
score: 0
Accepted
time: 1967ms
memory: 9080kb
input:
299063 1 43555 123588 78325 123495 254 276012 166974 51380 72497 218109 213412 63856 207536 197302 226247 21565 19086 149490 254 108981 141672 218109 261085 21430 100314 21565 77290 50133 99911 75924 110340 70298 72497 125475 50133 15572 60933 143796 107855 263643 207536 190963 93764 222967 742 1447...
output:
294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667 294667...
result:
ok 2880 tokens
Test #29:
score: 0
Accepted
time: 162ms
memory: 9072kb
input:
299533 11 245553 245553 18737 18737 18653 177824 292689 224787 115519 115519 115519 115519 18737 19878 224787 82151 245553 82151 18737 19878 292689 18653 19878 177824 177824 292689 292689 82151 76998 18737 88490 177824 224787 82151 115519 18737 18737 224787 292689 292689 115519 177824 88490 19878 88...
output:
292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689 292689...
result:
ok 2643 tokens
Test #30:
score: 0
Accepted
time: 652ms
memory: 7036kb
input:
299765 6 236781 236781 19486 168541 19486 19486 133187 19486 168541 242074 145952 212388 247061 212388 145952 133187 145952 19486 145952 133187 133187 182090 182090 212388 145952 168541 212388 212388 133187 133187 19486 242074 236781 236781 182090 145952 212388 182090 182090 212388 212388 247061 247...
output:
247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061 247061...
result:
ok 5927 tokens
Test #31:
score: -100
Time Limit Exceeded
input:
299033 3 12224 110737 136220 128020 9170 12224 138633 136220 136220 138633 136220 136220 138633 138633 220875 218966 110737 116982 12224 12224 136220 136220 9170 136220 9170 59097 12224 128020 218966 9170 136220 116982 9170 220875 128020 116982 138633 220875 110737 136220 110737 128020 220875 220875...