QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#784011 | #1132. Financial Report | _8_8_# | 28 | 10ms | 5760kb | C++17 | 1.1kb | 2024-11-26 12:39:15 | 2024-11-26 12:39:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = (int)1e6 + 12;
int n, d, a[N], dp[N];
void test() {
cin >> n >> d;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
int res = 1;
for(int i = 1; i <= n; i++) {
dp[i] = 1;
for(int j = i - 1; j >= 1; j--) {
if(a[j] < a[i]) {
int lst = j;
bool ok = 1;
for(int k = j + 1; k < i; k++) {
if(a[k] <= a[j]) {
if(k - lst > d) {
ok = 0;
}
lst = k;
}
}
if(i - lst > d) {
ok = 0;
}
if(ok) {
dp[i] = max(dp[j] + 1, dp[i]);
}
}
}
res = max(res, dp[i]);
}
cout << res << '\n';
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
while(t--)
test();
return 0;
}
詳細信息
Subtask #1:
score: 14
Accepted
Test #1:
score: 14
Accepted
time: 1ms
memory: 5620kb
input:
1 1 314159265
output:
1
result:
ok single line: '1'
Test #2:
score: 14
Accepted
time: 1ms
memory: 5692kb
input:
1 1 0
output:
1
result:
ok single line: '1'
Test #3:
score: 14
Accepted
time: 1ms
memory: 5624kb
input:
1 1 1000000000
output:
1
result:
ok single line: '1'
Test #4:
score: 14
Accepted
time: 1ms
memory: 5632kb
input:
2 1 299792458 299792458
output:
1
result:
ok single line: '1'
Test #5:
score: 14
Accepted
time: 1ms
memory: 5688kb
input:
2 1 141421356 173205080
output:
2
result:
ok single line: '2'
Test #6:
score: 14
Accepted
time: 1ms
memory: 5756kb
input:
2 1 244948974 223606797
output:
1
result:
ok single line: '1'
Test #7:
score: 14
Accepted
time: 1ms
memory: 5760kb
input:
2 2 299792458 299792458
output:
1
result:
ok single line: '1'
Test #8:
score: 14
Accepted
time: 0ms
memory: 5636kb
input:
2 2 141421356 173205080
output:
2
result:
ok single line: '2'
Test #9:
score: 14
Accepted
time: 1ms
memory: 5564kb
input:
2 2 244948974 223606797
output:
1
result:
ok single line: '1'
Test #10:
score: 14
Accepted
time: 0ms
memory: 5704kb
input:
3 1 500000000 1000000000 0
output:
2
result:
ok single line: '2'
Test #11:
score: 14
Accepted
time: 0ms
memory: 5568kb
input:
3 2 500000000 1000000000 0
output:
2
result:
ok single line: '2'
Test #12:
score: 14
Accepted
time: 0ms
memory: 5704kb
input:
4 1 0 1000000000 200000000 500000000
output:
2
result:
ok single line: '2'
Test #13:
score: 14
Accepted
time: 1ms
memory: 5708kb
input:
4 2 0 1000000000 200000000 500000000
output:
3
result:
ok single line: '3'
Test #14:
score: 14
Accepted
time: 1ms
memory: 5576kb
input:
5 2 111111111 888888888 555555555 222222222 444444444
output:
2
result:
ok single line: '2'
Test #15:
score: 14
Accepted
time: 1ms
memory: 5688kb
input:
19 1 876813783 876813783 294665595 1000000000 515198511 876813783 876813783 294665595 403855901 439947219 439947219 403855901 581007064 294665595 1000000000 581007064 294665595 865289906 865289906
output:
5
result:
ok single line: '5'
Test #16:
score: 14
Accepted
time: 1ms
memory: 5572kb
input:
17 2 49121102 449215299 18829293 449463830 765492419 440501697 233785699 50699732 569054461 105188844 983737936 877900994 0 44809615 361020433 74987201 725464354
output:
5
result:
ok single line: '5'
Test #17:
score: 14
Accepted
time: 1ms
memory: 5628kb
input:
15 3 807337796 807337796 807337796 807337796 807337796 807337796 807337796 807337796 807337796 807337796 807337796 807337796 807337796 807337796 807337796
output:
1
result:
ok single line: '1'
Test #18:
score: 14
Accepted
time: 1ms
memory: 5704kb
input:
20 7 733581184 733581184 0 205928229 0 733581184 1000000000 733581184 0 815970650 975939523 0 815970650 975939523 0 205928229 0 733581184 205928229 815970650
output:
5
result:
ok single line: '5'
Test #19:
score: 14
Accepted
time: 1ms
memory: 5756kb
input:
18 12 1000000000 358612551 1000000000 358612551 358612551 358612551 358612551 1000000000 1000000000 1000000000 358612551 358612551 1000000000 1000000000 358612551 1000000000 1000000000 358612551
output:
2
result:
ok single line: '2'
Test #20:
score: 14
Accepted
time: 1ms
memory: 5704kb
input:
20 20 802421546 601860856 909073419 815745406 913824895 924761528 954389636 774128549 427176220 23722581 439396497 59191904 121848351 774320268 817458024 565828491 890339952 82761751 717137276 524535907
output:
6
result:
ok single line: '6'
Test #21:
score: 14
Accepted
time: 1ms
memory: 5752kb
input:
20 2 220907318 325117564 759996279 361226977 713619929 530965981 367577457 488411054 555070688 620059582 541892208 949650763 645304844 727718360 709566813 803811825 110264462 960815323 875849635 450666865
output:
10
result:
ok single line: '10'
Test #22:
score: 14
Accepted
time: 1ms
memory: 5668kb
input:
20 4 920699809 20405458 430167187 323905322 321816206 337791282 869436958 505338540 45509543 532042224 672842133 816481120 854290279 948611594 979068279 996148973 674793874 347773693 320013346 759492294
output:
11
result:
ok single line: '11'
Test #23:
score: 14
Accepted
time: 1ms
memory: 5696kb
input:
20 1 10000000 60000000 110000000 160000000 210000000 260000000 310000000 360000000 410000000 460000000 510000000 560000000 610000000 660000000 710000000 760000000 810000000 860000000 910000000 960000000
output:
20
result:
ok single line: '20'
Test #24:
score: 14
Accepted
time: 1ms
memory: 5704kb
input:
20 1 970000000 920000000 870000000 820000000 770000000 720000000 670000000 620000000 570000000 520000000 470000000 420000000 370000000 320000000 270000000 220000000 170000000 120000000 70000000 20000000
output:
1
result:
ok single line: '1'
Test #25:
score: 14
Accepted
time: 1ms
memory: 5748kb
input:
16 5 68514423 410103741 591567982 865691960 982387008 223996512 306149309 324123848 352045607 927590130 238419389 252822214 452213108 539870292 860882612 965882206
output:
9
result:
ok single line: '9'
Test #26:
score: 14
Accepted
time: 0ms
memory: 5688kb
input:
17 4 22790108 220864673 248053769 404589265 637574960 166412775 260226295 262479043 286448651 300001992 734205739 58675918 181211505 263369364 299892200 509157732 867133240
output:
9
result:
ok single line: '9'
Subtask #2:
score: 14
Accepted
Dependency #1:
100%
Accepted
Test #27:
score: 14
Accepted
time: 7ms
memory: 5732kb
input:
400 1 697625071 338955244 701273756 765293932 12805194 46984119 775140965 390552579 875281333 950702147 361444232 680144638 917418512 747923326 543035419 899203308 659270340 218742714 484689980 866434940 270117732 538163289 665365203 226080481 734351408 300250974 824534838 56953777 250622631 4998775...
output:
15
result:
ok single line: '15'
Test #28:
score: 14
Accepted
time: 8ms
memory: 5704kb
input:
397 4 467705846 767740944 895438469 533795958 693293401 869030737 691890948 522874750 670064696 815950426 83220749 368503752 5886628 670367518 609376726 194811413 318102838 766625872 758649856 845072193 606306969 52285365 72714393 155785860 666438261 387383555 79107247 370372410 228320080 342363590 ...
output:
26
result:
ok single line: '26'
Test #29:
score: 14
Accepted
time: 7ms
memory: 5632kb
input:
375 7 419990450 226023065 518565144 389170913 6829200 997083989 55187689 570620839 206928279 344779139 772964274 597404515 211682354 376663678 431873380 459063765 949200561 855646588 968869829 258337829 459063765 389170913 877761657 893177314 949200561 914249958 155847450 195707470 313542363 6024787...
output:
30
result:
ok single line: '30'
Test #30:
score: 14
Accepted
time: 7ms
memory: 5632kb
input:
382 14 297641955 579261299 693365773 503834660 625185678 930401348 231126864 588719210 115995879 871663635 258093515 21599253 717037833 133866136 302501944 794309456 331324463 33313393 169169419 178114058 513684028 420634528 381201674 795038522 120614458 785418360 709760430 156406189 724382191 13433...
output:
33
result:
ok single line: '33'
Test #31:
score: 14
Accepted
time: 0ms
memory: 5632kb
input:
398 68 87296112 87296112 0 0 87296112 87296112 87296112 0 0 0 87296112 0 87296112 87296112 0 87296112 87296112 0 0 87296112 0 0 0 87296112 0 0 0 0 87296112 87296112 87296112 87296112 0 87296112 0 0 87296112 0 87296112 87296112 0 0 87296112 87296112 87296112 87296112 0 87296112 0 0 0 87296112 0 0 872...
output:
2
result:
ok single line: '2'
Test #32:
score: 14
Accepted
time: 8ms
memory: 5636kb
input:
400 400 313643918 524837714 454497606 202185266 437460102 990219224 516405597 233454847 415501995 729752658 126493633 349361696 745579115 265649159 131329130 891526222 924054909 942306716 304196292 299533653 551317273 576482438 187264127 512575413 296382331 880052159 639485797 822109205 525502039 92...
output:
37
result:
ok single line: '37'
Test #33:
score: 14
Accepted
time: 8ms
memory: 5636kb
input:
400 2 572992061 931760159 538911610 891579979 861642215 54327796 130767579 217152621 806772462 958998532 482498465 110236290 534509333 90384831 344203521 398544881 920189563 166667845 630221338 89304326 788119936 598881289 996249896 499062241 215002930 456126547 938742792 76742232 377279685 91368408...
output:
178
result:
ok single line: '178'
Test #34:
score: 14
Accepted
time: 8ms
memory: 5756kb
input:
400 6 32850957 474568476 227393309 630723698 167871732 354713013 389685651 299988790 967355970 965004350 715503841 467286086 498715418 471251794 460548737 517020574 748737219 244292652 90334581 755243526 495303468 333725872 857155431 190563758 754274079 750605544 808305303 937057193 418690406 968735...
output:
121
result:
ok single line: '121'
Test #35:
score: 14
Accepted
time: 10ms
memory: 5700kb
input:
400 8 79961857 576026118 16651375 879359072 193504323 569824876 634814541 871160695 511489526 173357034 97742195 84534766 954895737 964675532 544456288 68397614 125750383 789974450 428100633 274455301 851478710 380463960 686092199 325634643 617240385 320281317 103433469 850604969 887147210 652637705...
output:
81
result:
ok single line: '81'
Test #36:
score: 14
Accepted
time: 9ms
memory: 5700kb
input:
400 36 672509835 968244063 457843819 533220194 8063350 409206579 168978949 466574816 899087033 285953558 728053213 894434695 257073896 414052552 552097198 102236348 2414491 911600232 776967305 747095786 360363242 22141552 578403058 819697857 5849647 373314810 825058085 343112586 8395386 956557769 36...
output:
60
result:
ok single line: '60'
Test #37:
score: 14
Accepted
time: 10ms
memory: 5692kb
input:
391 5 15756643 28559248 17487648 28685063 41063081 16751972 11095509 23603424 24823382 7038374 41161660 18075846 20970076 12807907 26381790 18306742 40221542 46262836 44038516 35183563 35171512 39407822 32878890 52404899 22696539 57205882 38655319 49528464 49655633 29146099 43241199 55320605 4496007...
output:
130
result:
ok single line: '130'
Test #38:
score: 14
Accepted
time: 10ms
memory: 5636kb
input:
389 8 132932626 51483275 53053136 39473371 114679338 82014215 117871074 4578588 38886546 184183396 96824433 110271307 8869552 87165913 202416955 13377084 92703547 98501358 81507515 9116699 115752025 262825071 65150741 59092990 107677249 140705122 30582132 80644036 190412737 104863688 97316270 785163...
output:
72
result:
ok single line: '72'
Test #39:
score: 14
Accepted
time: 6ms
memory: 5700kb
input:
400 17 151095706 190975190 436755026 544554326 627550531 662975688 731354911 839795955 127584834 135440339 215656518 357864438 746751018 786782791 810927606 811210605 1237342 66583570 331360859 368102996 500057934 742456547 813503798 981487152 17041396 274598434 683481223 698445202 704291741 8901336...
output:
39
result:
ok single line: '39'
Test #40:
score: 14
Accepted
time: 5ms
memory: 5692kb
input:
400 26 919068014 915312027 877597208 861346503 861071054 802433166 769027385 749253388 747182416 736938102 716626759 709839569 693282274 676841819 642280286 621501313 616134084 612553098 477369992 409815828 362120372 324994216 312898769 278866725 267550910 230290918 198714023 159535083 145963617 144...
output:
12
result:
ok single line: '12'
Subtask #3:
score: 0
Time Limit Exceeded
Dependency #2:
100%
Accepted
Test #41:
score: 0
Time Limit Exceeded
input:
7000 1 894882663 687753860 274846006 785270210 3034342 194264610 291176506 356300576 120019831 305340082 101303261 801498371 440274687 761247865 857100563 398852968 963685664 414803100 659457692 531909044 617088521 745956160 841866618 606356828 951489050 862821239 183071512 867632063 206346442 96390...
output:
result:
Subtask #4:
score: 0
Time Limit Exceeded
Test #62:
score: 0
Time Limit Exceeded
input:
300000 1 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 285899902 2...
output:
result:
Subtask #5:
score: 0
Time Limit Exceeded
Test #76:
score: 0
Time Limit Exceeded
input:
300000 300000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 ...
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
0%