QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#142330 | #1132. Financial Report | Wawi# | 14 | 0ms | 3812kb | C++20 | 848b | 2023-08-18 23:32:57 | 2024-07-04 02:39:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
int n,d; cin >> n >> d;
vector<int> arr(n+10);
vector<int> dp(n+10);
for(int i = 1; i <= n; i++) cin >> arr[i];
dp[1] = 1;
int ans = 1;
for(int i = 2; i <= n; i++){
dp[i] = 1;
for(int j = max(i - d + 1, 1); j < i; j++){
if(arr[j] < arr[i]){
dp[i] = max(dp[i], dp[j] + 1);
}
}
for(int j = i - d; j > 0; j--){
if(arr[j] >= arr[i]) break;
dp[i] = max(dp[i], dp[j] + 1);
}
int temp = dp[i];
for(int j = 1; j < i; j++){
if(arr[j] > arr[i]){
temp = max(temp, dp[j]);
}
}
ans = max(ans, temp);
}
cout << ans << endl;
}
int main() {
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t=1;
// cin >> t;
while(t--){
solve();
}
return 0;
}
详细
Subtask #1:
score: 14
Accepted
Test #1:
score: 14
Accepted
time: 0ms
memory: 3744kb
input:
1 1 314159265
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
1 1 0
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
1 1 1000000000
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2 1 299792458 299792458
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
2 1 141421356 173205080
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
2 1 244948974 223606797
output:
1
result:
ok single line: '1'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
2 2 299792458 299792458
output:
1
result:
ok single line: '1'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
2 2 141421356 173205080
output:
2
result:
ok single line: '2'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
2 2 244948974 223606797
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
3 1 500000000 1000000000 0
output:
2
result:
ok single line: '2'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
3 2 500000000 1000000000 0
output:
2
result:
ok single line: '2'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
4 1 0 1000000000 200000000 500000000
output:
2
result:
ok single line: '2'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
4 2 0 1000000000 200000000 500000000
output:
3
result:
ok single line: '3'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
5 2 111111111 888888888 555555555 222222222 444444444
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3612kb
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: 0
Accepted
time: 0ms
memory: 3748kb
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: 0
Accepted
time: 0ms
memory: 3520kb
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: 0
Accepted
time: 0ms
memory: 3572kb
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: 0
Accepted
time: 0ms
memory: 3520kb
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: 0
Accepted
time: 0ms
memory: 3524kb
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: 0
Accepted
time: 0ms
memory: 3608kb
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: 0
Accepted
time: 0ms
memory: 3580kb
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: 0
Accepted
time: 0ms
memory: 3540kb
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: 0
Accepted
time: 0ms
memory: 3580kb
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: 0
Accepted
time: 0ms
memory: 3592kb
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: 0
Accepted
time: 0ms
memory: 3588kb
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: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #27:
score: 14
Accepted
time: 0ms
memory: 3524kb
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
Wrong Answer
time: 0ms
memory: 3616kb
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:
17
result:
wrong answer 1st lines differ - expected: '26', found: '17'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
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:
0%