QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783991#1132. Financial Report_8_8_#14 168ms5880kbC++171.0kb2024-11-26 12:33:202024-11-26 12:33:21

Judging History

你现在查看的是最新测评结果

  • [2024-11-26 12:33:21]
  • 评测
  • 测评结果:14
  • 用时:168ms
  • 内存:5880kb
  • [2024-11-26 12:33:20]
  • 提交

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;
    if(n > 20) return;
    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: 5656kb

input:

1 1
314159265

output:

1

result:

ok single line: '1'

Test #2:

score: 14
Accepted
time: 1ms
memory: 5852kb

input:

1 1
0

output:

1

result:

ok single line: '1'

Test #3:

score: 14
Accepted
time: 1ms
memory: 5856kb

input:

1 1
1000000000

output:

1

result:

ok single line: '1'

Test #4:

score: 14
Accepted
time: 1ms
memory: 5596kb

input:

2 1
299792458 299792458

output:

1

result:

ok single line: '1'

Test #5:

score: 14
Accepted
time: 1ms
memory: 5860kb

input:

2 1
141421356 173205080

output:

2

result:

ok single line: '2'

Test #6:

score: 14
Accepted
time: 1ms
memory: 5536kb

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: 5544kb

input:

2 2
141421356 173205080

output:

2

result:

ok single line: '2'

Test #9:

score: 14
Accepted
time: 1ms
memory: 5660kb

input:

2 2
244948974 223606797

output:

1

result:

ok single line: '1'

Test #10:

score: 14
Accepted
time: 1ms
memory: 5656kb

input:

3 1
500000000 1000000000 0

output:

2

result:

ok single line: '2'

Test #11:

score: 14
Accepted
time: 1ms
memory: 5596kb

input:

3 2
500000000 1000000000 0

output:

2

result:

ok single line: '2'

Test #12:

score: 14
Accepted
time: 1ms
memory: 5660kb

input:

4 1
0 1000000000 200000000 500000000

output:

2

result:

ok single line: '2'

Test #13:

score: 14
Accepted
time: 1ms
memory: 5696kb

input:

4 2
0 1000000000 200000000 500000000

output:

3

result:

ok single line: '3'

Test #14:

score: 14
Accepted
time: 1ms
memory: 5608kb

input:

5 2
111111111 888888888 555555555 222222222 444444444

output:

2

result:

ok single line: '2'

Test #15:

score: 14
Accepted
time: 81ms
memory: 5860kb

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: 21ms
memory: 5600kb

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: 5668kb

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: 168ms
memory: 5604kb

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: 40ms
memory: 5820kb

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: 166ms
memory: 5656kb

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: 161ms
memory: 5856kb

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: 167ms
memory: 5880kb

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: 160ms
memory: 5600kb

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: 157ms
memory: 5632kb

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: 5656kb

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: 21ms
memory: 5660kb

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: 0ms
memory: 3808kb

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:


result:

wrong answer 1st lines differ - expected: '15', found: ''

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #62:

score: 0
Wrong Answer
time: 0ms
memory: 3556kb

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:

wrong answer 1st lines differ - expected: '1', found: ''

Subtask #5:

score: 0
Wrong Answer

Test #76:

score: 0
Wrong Answer
time: 0ms
memory: 3848kb

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:

wrong answer 1st lines differ - expected: '1', found: ''

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%