QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#784026#1132. Financial Report_8_8_#0 1ms5756kbC++17878b2024-11-26 12:48:262024-11-26 12:48:27

Judging History

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

  • [2024-11-26 12:48:27]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:5756kb
  • [2024-11-26 12:48:26]
  • 提交

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] = max(dp[i], 1);
        int lst = i;
        int prv = a[i];
        for(int j = i + 1; j  <= n; j++) {
            if(j - lst > d) break;
            if(a[j] <= a[i]) {
                lst = j;
            }
            if(a[j] > prv) {
                dp[j] = max(dp[j], dp[i] + 1);
                prv = a[j];
            }
        }
        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;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

1 1
314159265

output:

1

result:

ok single line: '1'

Test #2:

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

input:

1 1
0

output:

1

result:

ok single line: '1'

Test #3:

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

input:

1 1
1000000000

output:

1

result:

ok single line: '1'

Test #4:

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

input:

2 1
299792458 299792458

output:

1

result:

ok single line: '1'

Test #5:

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

input:

2 1
141421356 173205080

output:

2

result:

ok single line: '2'

Test #6:

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

input:

2 1
244948974 223606797

output:

1

result:

ok single line: '1'

Test #7:

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

input:

2 2
299792458 299792458

output:

1

result:

ok single line: '1'

Test #8:

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

input:

2 2
141421356 173205080

output:

2

result:

ok single line: '2'

Test #9:

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

input:

2 2
244948974 223606797

output:

1

result:

ok single line: '1'

Test #10:

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

input:

3 1
500000000 1000000000 0

output:

2

result:

ok single line: '2'

Test #11:

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

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: 0
Wrong Answer
time: 0ms
memory: 5680kb

input:

4 2
0 1000000000 200000000 500000000

output:

2

result:

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

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

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:

0%