QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#516835 | #4563. Radio Towers | kimmoqt | 11 | 7ms | 4128kb | C++20 | 824b | 2024-08-12 22:15:25 | 2024-08-12 22:15:26 |
Judging History
answer
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
const int MX=2005;
int N;
vector<int> H;
int dp[MX][2];
void init(int N, std::vector<int> H) {
::N=N, ::H=H;
}
int max_towers(int L, int R, int D) {
for(int i=0;i<N;i++) {
dp[i][0]=dp[i][1]=-1;
}
int res=0;
for(int i=L;i<=R;i++) {
dp[i][0]=1;
for(int j=L;j<i;j++) {
if(H[j]+D<=H[i]) {
dp[i][1]=max(dp[i][1],dp[j][0]);
}
if(H[j]>=H[i]+D) {
dp[i][0]=max(dp[i][0],dp[j][1]+1);
}
}
res=max(res,dp[i][0]);
}
return res;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
input:
59640 49885 57346 58504 87383 113182 129676 204090 205404 259925 276583 300332 324014 333675 359377 364049 408489 414852 428310 438038 440113 458193 554789 643468 666525 683112 690791 707313 720088 741028 748785 789826 796576 800966 832867 851750 861044 862283 900756 926925 939560 955678 965636 9740...
output:
result:
Subtask #2:
score: 11
Accepted
Test #8:
score: 11
Accepted
time: 1ms
memory: 3768kb
input:
425 753881706 405729786 890889563 29736246 598281970 208352067 357783003 663497023 178397034 4832890 562140755 510307001 354540290 538848551 436879256 86659033 42928516 24145404 749159097 118423198 506851985 204895765 719719998 726244368 991372008 681703480 799303017 657138050 88278945 417801236 260...
output:
13
result:
ok 3 lines
Test #9:
score: 11
Accepted
time: 3ms
memory: 3800kb
input:
2000 510696791 617882876 373405425 518361747 407161508 435668375 559543221 465317236 38039460 717410075 714427583 977153243 679286738 23933545 750215417 37078782 973334934 244734879 243897181 603105656 981870220 85688930 807317304 901266308 225354691 737318933 824323690 365669439 111883771 153256479...
output:
292
result:
ok 3 lines
Test #10:
score: 11
Accepted
time: 1ms
memory: 3892kb
input:
2000 516351740 512181903 200723571 993230512 160881035 858124753 539677115 120758992 855511696 883443323 930303372 707938300 186981787 145199071 581235758 65550786 7197175 474759320 732341567 517832089 220614631 428681162 168642809 331743780 689236970 514407524 725936494 447118446 628858360 36946526...
output:
91
result:
ok 3 lines
Test #11:
score: 11
Accepted
time: 0ms
memory: 4128kb
input:
2000 9654673 812116916 373455422 816862897 353222263 785552601 262143032 654718863 361397545 763154940 79011466 983035671 46521930 654559175 371270845 610911343 19671952 831534324 157278884 850193672 83857278 600512673 91419235 820220378 19933790 959137813 447541847 957882585 47577396 981451791 2290...
output:
336
result:
ok 3 lines
Test #12:
score: 11
Accepted
time: 1ms
memory: 3824kb
input:
2000 101597651 901337214 94865893 515541321 223422476 791229261 361846447 652989994 147299317 644867197 32737606 525776949 182468296 547470985 330848340 873710937 392296086 971753844 156102346 764082424 254318166 685488259 221310405 521552461 481853974 868664461 300437861 938093383 466194541 6653033...
output:
176
result:
ok 3 lines
Test #13:
score: 11
Accepted
time: 1ms
memory: 4128kb
input:
2000 472936055 973169917 157888070 752944598 254539436 814034071 26698036 538887055 429236303 861439585 333049317 960563190 374468157 913310144 89434192 863875353 370790916 558434605 461824050 727741912 341709750 906272885 334496641 886737508 281651305 854169557 304260640 494128561 360711440 5339229...
output:
130
result:
ok 3 lines
Test #14:
score: 11
Accepted
time: 0ms
memory: 4112kb
input:
2000 448125011 914906568 342296305 596847215 308205069 607246435 321988425 906263458 12754675 760166384 151837669 976756930 492753133 973159665 56759675 984884487 393926205 542913032 452064909 641120579 160301206 621818390 240470745 728458832 262255458 718912726 467544291 738536144 174343867 6066620...
output:
34
result:
ok 3 lines
Test #15:
score: 11
Accepted
time: 1ms
memory: 3768kb
input:
2000 63119 1763800 2560156 2577120 2947719 4220876 4493280 5257204 5695924 6255528 6688141 6874164 6986335 8608902 8655716 8667255 8733692 9297137 9612369 10639944 11677890 11850447 12123475 12942200 13292330 13630586 14006505 14704409 15864169 16065863 16090141 16348841 16582396 16707789 16914115 1...
output:
1
result:
ok 3 lines
Test #16:
score: 11
Accepted
time: 0ms
memory: 3772kb
input:
2000 999953545 999809722 999269748 998652085 998032618 997532818 996831561 996646538 995713640 994955665 994498039 993763043 993402749 993344498 992641411 991413401 991243813 990462579 989638909 988726451 988562857 985375670 983150768 982174289 982096151 981854907 981126710 980498905 979609052 97882...
output:
1
result:
ok 3 lines
Test #17:
score: 11
Accepted
time: 1ms
memory: 3888kb
input:
2000 513304 679545 683376 1330519 1389514 2537850 2773316 2812312 3237767 3896687 3989417 4104806 4468408 4893577 5094758 5322413 6269737 6564230 7102596 7379997 7942696 8362867 8543645 9336109 10288566 10317516 11169045 11188413 11774267 12334498 13040401 13398797 13472581 13524263 13682076 1493169...
output:
1
result:
ok 3 lines
Test #18:
score: 11
Accepted
time: 1ms
memory: 3800kb
input:
2000 999767480 999639155 999609042 998925691 998464928 996821425 996683829 996595059 996326912 996298094 995988614 995835236 995756420 994911243 994766270 994353107 994313741 994155172 994005150 993901305 993851772 993130682 993058863 992579160 992456330 992062631 991583495 991577017 991508098 99132...
output:
1
result:
ok 3 lines
Test #19:
score: 11
Accepted
time: 1ms
memory: 4088kb
input:
5 1 3 5 4 2 1 3 1 -2 -2 -2 -2 -2 -2 -1 -1 -1
output:
2
result:
ok 3 lines
Test #20:
score: 11
Accepted
time: 0ms
memory: 4116kb
input:
2000 2864867 4393346 8810369 10207341 13590139 13917112 14896351 15147853 20101448 21379352 22090206 23288189 23589362 23944328 26240608 27933494 30968870 36267127 36364994 38208187 38368254 42600803 42837826 44065373 44518670 51922037 56670571 58860102 59719065 64443762 68818951 71935230 75488444 8...
output:
1
result:
ok 3 lines
Test #21:
score: 11
Accepted
time: 1ms
memory: 3884kb
input:
2000 999760365 998999673 998135281 997844414 997803038 997402755 997139023 997116579 996760663 996722183 996505625 996458058 996210869 996075186 996066073 994149260 993715588 993676466 993655905 993082421 991612027 990710609 990463448 990116777 988414051 988167503 987999136 987879309 987197011 98706...
output:
1
result:
ok 3 lines
Test #22:
score: 11
Accepted
time: 1ms
memory: 4020kb
input:
2000 158938328 621066509 269484140 904716370 139334670 245496632 263105804 6079993 710962096 257464381 612375466 473380320 466047916 2811339 216945685 339797759 216334021 277582256 642097167 429466766 233888460 525812254 672999308 768977991 684199656 167081449 228642547 494801576 265253327 799450311...
output:
79
result:
ok 3 lines
Test #23:
score: 11
Accepted
time: 3ms
memory: 4120kb
input:
2000 359644685 703734272 377862023 641893808 143410877 977707061 179250195 977026605 363644192 526819838 54306668 560233146 51738929 592499153 335983810 971739801 376096378 595674757 203468917 656585670 483673011 620618118 214853234 653740394 344634953 963491779 15077596 563898703 68485795 894047611...
output:
738
result:
ok 3 lines
Test #24:
score: 11
Accepted
time: 1ms
memory: 4124kb
input:
2000 274918408 926448247 101747394 698272164 413668405 951231007 90273823 610561989 383171183 736623499 340218995 929415027 286198184 851805443 301639576 622897418 453403720 716417420 112284375 966699225 217832616 568879951 128445072 537355265 79961425 846295606 264502249 565378787 58241482 60245516...
output:
275
result:
ok 3 lines
Test #25:
score: 11
Accepted
time: 1ms
memory: 3816kb
input:
2000 999543875 998401311 997228478 996982580 996953622 996680623 996493278 996430771 996168915 996133464 995910201 995495403 995029376 994538854 994356013 994339884 994213270 993793205 993318864 992639646 992561744 991783149 991553400 990662346 990614208 990246096 990205513 989843013 989603902 98949...
output:
1
result:
ok 3 lines
Test #26:
score: 11
Accepted
time: 0ms
memory: 3828kb
input:
2000 97693 316539 803236 1779426 2152902 2965818 3685622 4836865 6780301 6847900 7020090 7186755 7870315 8106356 8614799 10629612 10777081 10963313 11183317 11446857 11840148 13231091 13237840 14290924 14355038 14374584 15527125 16050083 17664481 18314750 19666607 20290382 20807669 21026464 21578348...
output:
1
result:
ok 3 lines
Test #27:
score: 11
Accepted
time: 6ms
memory: 3824kb
input:
2000 727710086 780139859 677203358 181956736 286703701 116570936 357010406 755277395 393564114 32547148 250504125 453918118 862819302 675624697 940242753 96785309 24513843 52289009 732527849 211699785 628179030 909281138 691304647 488343010 478031652 683768193 173263301 386737166 537193966 391307824...
output:
670
result:
ok 3 lines
Test #28:
score: 11
Accepted
time: 2ms
memory: 3904kb
input:
2000 33815833 542923331 300887504 739844428 376045390 868330148 495545978 851557510 404790392 979842344 111668597 553358192 449185089 809474976 364826237 835322881 481756945 630783273 113708281 580426744 211174921 660021127 155772259 888525534 82767103 697158115 47139921 947493036 418538044 87136554...
output:
1000
result:
ok 3 lines
Test #29:
score: 11
Accepted
time: 5ms
memory: 3888kb
input:
2000 60604602 655118152 200152149 763099825 72662101 871084501 387352117 966957060 100849937 895167791 76425600 931301097 210114664 759778159 355477403 853342388 453653511 900772156 469128723 576400668 15345685 648798285 284571017 669089083 140673762 677268969 124811359 645329966 307478491 811573113...
output:
1000
result:
ok 3 lines
Test #30:
score: 11
Accepted
time: 2ms
memory: 3844kb
input:
2000 998992835 998647994 997797007 997324084 997284164 997160370 996991225 996464975 995951282 994999185 992539195 991842012 991661197 991447126 991358231 991127617 990303081 988676677 988634240 988623642 988425967 987678183 986335227 986003921 985860328 984629267 982792258 981807277 981669981 98051...
output:
1
result:
ok 3 lines
Test #31:
score: 11
Accepted
time: 5ms
memory: 3768kb
input:
2000 24639 286326 1312015 1509380 2478473 2576331 4119330 4980462 5029392 6349278 6882386 6977265 8261280 8322679 8636798 9341017 9694336 13490026 16368604 16905457 17042276 17184517 17281484 17304972 17613602 18483929 18830930 19801842 20177516 20198093 20497143 21295463 21353981 21465065 21663986 ...
output:
5
result:
ok 3 lines
Test #32:
score: 11
Accepted
time: 1ms
memory: 4116kb
input:
896 508914685 950979790 172424465 965511698 420540781 262980933 257496294 753767238 546972145 513258270 766261434 934053985 521082196 792280493 730134796 518498127 57334998 291152390 408110825 423135711 137164646 586247999 719640627 505791999 109848039 714601649 768140766 275711489 645079915 7606835...
output:
34
result:
ok 3 lines
Test #33:
score: 11
Accepted
time: 3ms
memory: 3796kb
input:
2000 954370524 377190793 766259243 344993099 167089609 39810 600020855 187898584 982599661 948684690 425169536 804182338 483576428 424317475 918106308 910444564 394638067 214932276 98061294 836591638 721427448 645024673 140323089 708762247 589992956 199366752 882109932 680224866 158343370 177501631 ...
output:
153
result:
ok 3 lines
Test #34:
score: 11
Accepted
time: 7ms
memory: 3820kb
input:
2000 960025473 271489820 448353198 969604968 923068593 422496188 580154749 843340340 800071897 262201586 493561677 829934691 696304182 690807193 749126649 791432920 281016660 857281580 586505680 456350775 109914963 840533257 501648593 139239719 53875235 976455342 931206384 761673874 675317959 503642...
output:
422
result:
ok 3 lines
Test #35:
score: 11
Accepted
time: 5ms
memory: 4084kb
input:
2000 222352673 701021504 49588498 584295046 138803159 967922576 19577203 544071071 236487957 556013414 304155111 723083792 59961240 538376264 208302692 594331770 385096003 677931229 149162566 700874934 65563246 863353247 30941830 999244376 262505090 614295592 19389185 671344230 392056889 967901664 4...
output:
380
result:
ok 3 lines
Test #36:
score: 11
Accepted
time: 4ms
memory: 3908kb
input:
2000 112345869 592550296 12582012 651036940 62269171 717753979 362857832 809169454 39104194 528546611 357495551 543926792 124950694 834115502 119806149 945934658 402803957 954320750 419022173 992594379 64295636 999973468 461608728 858525666 199892136 996417868 224122557 747502430 495580205 515760922...
output:
466
result:
ok 3 lines
Test #37:
score: 11
Accepted
time: 4ms
memory: 3820kb
input:
2000 88438379 985670200 210433606 538551487 131199563 772588384 179015543 537394046 80932007 989822412 485940021 842540800 439780553 671274457 85420639 736214435 362159903 868083918 276042295 511854344 25568321 863928382 415270971 803397948 162142390 801005906 136991929 612529286 160087285 967069553...
output:
206
result:
ok 3 lines
Test #38:
score: 11
Accepted
time: 4ms
memory: 3828kb
input:
2000 48427571 606119650 374510465 866934978 455550276 556921037 355254236 963346357 93437384 759895166 246709958 639755067 64844640 731119367 471748204 786457845 368601072 768674020 482176017 719695254 75221674 776433417 518334434 554127730 505857969 676971759 105860311 998773515 119484448 557927039...
output:
260
result:
ok 3 lines
Test #39:
score: 11
Accepted
time: 4ms
memory: 3764kb
input:
2000 654028 839352 1473945 2848149 3457395 4383124 4690374 4837547 4905727 5712852 5930233 6465880 6466618 7298560 7982495 9752751 10433660 10448024 11016930 11470575 12424686 13007835 13229308 13349135 13561936 13812087 14690793 15072031 17155902 17194907 17259603 17596205 18124515 18705749 1995223...
output:
1
result:
ok 3 lines
Test #40:
score: 11
Accepted
time: 1ms
memory: 4128kb
input:
2000 998386922 997473527 996666363 995006492 994924532 994843631 993733996 993467847 993407871 992635144 992099508 991999680 991652687 991214170 990170287 989855622 989456663 989419075 988951324 988124095 987648622 987122274 986970481 986167349 985466413 985224384 985219860 984168750 984084244 98369...
output:
1
result:
ok 3 lines
Test #41:
score: 11
Accepted
time: 3ms
memory: 4112kb
input:
2000 711095 1021095 1145756 1446031 1901770 2166976 2340602 3681515 4122678 4244456 5048255 5104979 5114586 5409856 5913655 5996888 6051190 6614480 7201652 7309546 7506686 8712565 8973966 9526366 9620761 10318148 10452070 10664914 10886810 11129303 11935955 12881725 13358900 13879469 13881202 144640...
output:
1
result:
ok 3 lines
Test #42:
score: 11
Accepted
time: 3ms
memory: 3820kb
input:
2000 999080150 998924650 998756163 998199572 996970216 996445167 995483650 995377744 995033336 994356447 994330300 994283793 993927308 993171717 992815228 992800552 992568400 991298818 990325373 990173121 990027375 989973698 989543426 989396281 989021441 988559241 988407728 987974412 987646293 98715...
output:
5
result:
ok 3 lines
Subtask #3:
score: 0
Runtime Error
Dependency #2:
100%
Accepted
Test #43:
score: 0
Runtime Error
input:
65076 604676696 423118410 564678886 369832239 984799638 664620633 510599965 415614079 160352783 150426542 29398773 576003056 217024519 68460187 536508550 695688755 632741816 575256828 37809537 438079521 993476763 36711290 182274162 457978366 735319199 637287621 177038334 200349879 855842670 28208763...
output:
result:
Subtask #4:
score: 0
Runtime Error
Test #65:
score: 0
Runtime Error
input:
99308 491693640 24020487 317364185 726230755 737284540 951143270 709116045 641023337 360629062 964879440 47884022 532494780 803629825 635450854 688041998 573937055 113198481 191311841 929603572 636688 598629732 895342035 396521271 619919754 716589045 657789547 373121546 866402108 609316614 60046511 ...
output:
result:
Subtask #5:
score: 0
Runtime Error
Test #86:
score: 0
Runtime Error
input:
23881 605288257 422163932 155875880 339929874 76049859 196344969 958160745 767945284 469191956 997116006 387749577 15911341 920437918 367576975 800789357 351557615 283723284 369507452 841548133 643412903 309731505 256549694 370065644 699518122 559017597 347646657 469353381 575240521 501893001 454519...
output:
result:
Subtask #6:
score: 0
Runtime Error
Test #97:
score: 0
Runtime Error
input:
88768 238644804 620122421 789364401 899010695 885388612 437964772 845379533 657562749 773925456 625793781 916240972 291506550 379611161 905077982 629848170 530056471 520438258 806293637 326792996 785404568 74285074 565304193 846963319 63529729 804909008 212070492 69936548 656129389 408708069 3070450...
output:
result:
Subtask #7:
score: 0
Skipped
Dependency #1:
0%