QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783968#1132. Financial Report_8_8_#0 1ms5756kbC++171.1kb2024-11-26 12:27:572024-11-26 12:28:02

Judging History

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

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

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 = 0;
    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;
}

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

input:

1 1
314159265

output:

1

result:

ok single line: '1'

Test #2:

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

input:

1 1
0

output:

1

result:

ok single line: '1'

Test #3:

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

input:

1 1
1000000000

output:

1

result:

ok single line: '1'

Test #4:

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

input:

2 1
299792458 299792458

output:

1

result:

ok single line: '1'

Test #5:

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

input:

2 1
141421356 173205080

output:

2

result:

ok single line: '2'

Test #6:

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

input:

2 1
244948974 223606797

output:

1

result:

ok single line: '1'

Test #7:

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

input:

2 2
299792458 299792458

output:

1

result:

ok single line: '1'

Test #8:

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

input:

2 2
141421356 173205080

output:

2

result:

ok single line: '2'

Test #9:

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

input:

2 2
244948974 223606797

output:

1

result:

ok single line: '1'

Test #10:

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

input:

3 1
500000000 1000000000 0

output:

2

result:

ok single line: '2'

Test #11:

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

input:

3 2
500000000 1000000000 0

output:

2

result:

ok single line: '2'

Test #12:

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

input:

4 1
0 1000000000 200000000 500000000

output:

2

result:

ok single line: '2'

Test #13:

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

input:

4 2
0 1000000000 200000000 500000000

output:

3

result:

ok single line: '3'

Test #14:

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

input:

5 2
111111111 888888888 555555555 222222222 444444444

output:

2

result:

ok single line: '2'

Test #15:

score: 0
Wrong Answer
time: 1ms
memory: 5660kb

input:

19 1
876813783 876813783 294665595 1000000000 515198511 876813783 876813783 294665595 403855901 439947219 439947219 403855901 581007064 294665595 1000000000 581007064 294665595 865289906 865289906

output:

3

result:

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

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%