QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#783990 | #1132. Financial Report | _8_8_# | 14 | 158ms | 7584kb | C++17 | 1.0kb | 2024-11-26 12:32:56 | 2024-11-26 12:33:10 |
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 = 0; i < n; i++) {
cin >> a[i];
}
int ans = 1;
for(int i = 1; i < (1 << n); i++) {
int res = 0;
vector<int> p;
for(int j = 0; j < n; j++) {
if((i >> j) & 1) {
p.push_back(j);
}
}
if(p.back() != n - 1) continue;
res = 1;
int mx = a[p[0]];
for(int j = 1; j < (int)p.size(); j++) {
if(p[j] - p[j - 1] > d) {
res = -(int)1e9;
}
if(a[p[j]] > mx) {
mx = a[p[j]];
res++;
}
}
ans = max(ans, res);
}
cout << ans << '\n';
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
while(t--)
test();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 14
Accepted
Test #1:
score: 14
Accepted
time: 1ms
memory: 5576kb
input:
1 1 314159265
output:
1
result:
ok single line: '1'
Test #2:
score: 14
Accepted
time: 1ms
memory: 5828kb
input:
1 1 0
output:
1
result:
ok single line: '1'
Test #3:
score: 14
Accepted
time: 1ms
memory: 5576kb
input:
1 1 1000000000
output:
1
result:
ok single line: '1'
Test #4:
score: 14
Accepted
time: 1ms
memory: 5572kb
input:
2 1 299792458 299792458
output:
1
result:
ok single line: '1'
Test #5:
score: 14
Accepted
time: 1ms
memory: 5636kb
input:
2 1 141421356 173205080
output:
2
result:
ok single line: '2'
Test #6:
score: 14
Accepted
time: 1ms
memory: 5576kb
input:
2 1 244948974 223606797
output:
1
result:
ok single line: '1'
Test #7:
score: 14
Accepted
time: 1ms
memory: 5660kb
input:
2 2 299792458 299792458
output:
1
result:
ok single line: '1'
Test #8:
score: 14
Accepted
time: 1ms
memory: 5640kb
input:
2 2 141421356 173205080
output:
2
result:
ok single line: '2'
Test #9:
score: 14
Accepted
time: 1ms
memory: 5868kb
input:
2 2 244948974 223606797
output:
1
result:
ok single line: '1'
Test #10:
score: 14
Accepted
time: 1ms
memory: 5572kb
input:
3 1 500000000 1000000000 0
output:
2
result:
ok single line: '2'
Test #11:
score: 14
Accepted
time: 1ms
memory: 5872kb
input:
3 2 500000000 1000000000 0
output:
2
result:
ok single line: '2'
Test #12:
score: 14
Accepted
time: 1ms
memory: 5640kb
input:
4 1 0 1000000000 200000000 500000000
output:
2
result:
ok single line: '2'
Test #13:
score: 14
Accepted
time: 1ms
memory: 5828kb
input:
4 2 0 1000000000 200000000 500000000
output:
3
result:
ok single line: '3'
Test #14:
score: 14
Accepted
time: 1ms
memory: 5824kb
input:
5 2 111111111 888888888 555555555 222222222 444444444
output:
2
result:
ok single line: '2'
Test #15:
score: 14
Accepted
time: 78ms
memory: 5828kb
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: 16ms
memory: 5532kb
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: 5ms
memory: 5660kb
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: 157ms
memory: 5832kb
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: 34ms
memory: 5796kb
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: 157ms
memory: 5876kb
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: 158ms
memory: 5828kb
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: 158ms
memory: 5524kb
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: 154ms
memory: 5532kb
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: 152ms
memory: 5872kb
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: 10ms
memory: 5596kb
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: 20ms
memory: 5656kb
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: 0
Wrong Answer
time: 47ms
memory: 5864kb
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:
1
result:
wrong answer 1st lines differ - expected: '15', found: '1'
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Wrong Answer
Test #62:
score: 12
Accepted
time: 17ms
memory: 5660kb
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:
1
result:
ok single line: '1'
Test #63:
score: 0
Wrong Answer
time: 18ms
memory: 5704kb
input:
299971 1 213313757 312061773 790195557 213313757 0 790195557 30936680 832403554 312061773 30936680 0 213313757 329317874 329317874 0 0 329317874 329317874 0 213313757 329317874 790195557 832403554 832403554 329317874 312061773 832403554 832403554 329317874 329317874 312061773 790195557 790195557 790...
output:
1
result:
wrong answer 1st lines differ - expected: '7', found: '1'
Subtask #5:
score: 0
Time Limit Exceeded
Test #76:
score: 5
Accepted
time: 18ms
memory: 7584kb
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:
1
result:
ok single line: '1'
Test #77:
score: 0
Time Limit Exceeded
input:
299994 299994 799095588 515641284 851040998 371590609 581412250 114983578 870953189 65883574 114983578 546636247 675572999 416143410 763181943 799095588 564152084 521371792 455808474 799095588 870953189 839155298 684313832 605076527 675572999 219704773 684313832 372618560 875093839 41381734 11498357...
output:
result:
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%