QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#784006 | #1132. Financial Report | _8_8_# | 0 | 1ms | 5760kb | C++17 | 1.1kb | 2024-11-26 12:37:47 | 2024-11-26 12:37:52 |
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] = 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;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 14
Accepted
time: 1ms
memory: 5624kb
input:
1 1 314159265
output:
1
result:
ok single line: '1'
Test #2:
score: 14
Accepted
time: 1ms
memory: 5568kb
input:
1 1 0
output:
1
result:
ok single line: '1'
Test #3:
score: 14
Accepted
time: 1ms
memory: 5624kb
input:
1 1 1000000000
output:
1
result:
ok single line: '1'
Test #4:
score: 14
Accepted
time: 1ms
memory: 5612kb
input:
2 1 299792458 299792458
output:
1
result:
ok single line: '1'
Test #5:
score: 14
Accepted
time: 0ms
memory: 5624kb
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: 0ms
memory: 5572kb
input:
2 2 299792458 299792458
output:
1
result:
ok single line: '1'
Test #8:
score: 14
Accepted
time: 0ms
memory: 5700kb
input:
2 2 141421356 173205080
output:
2
result:
ok single line: '2'
Test #9:
score: 14
Accepted
time: 0ms
memory: 5692kb
input:
2 2 244948974 223606797
output:
1
result:
ok single line: '1'
Test #10:
score: 14
Accepted
time: 0ms
memory: 5564kb
input:
3 1 500000000 1000000000 0
output:
2
result:
ok single line: '2'
Test #11:
score: 14
Accepted
time: 1ms
memory: 5760kb
input:
3 2 500000000 1000000000 0
output:
2
result:
ok single line: '2'
Test #12:
score: 14
Accepted
time: 1ms
memory: 5696kb
input:
4 1 0 1000000000 200000000 500000000
output:
2
result:
ok single line: '2'
Test #13:
score: 14
Accepted
time: 1ms
memory: 5608kb
input:
4 2 0 1000000000 200000000 500000000
output:
3
result:
ok single line: '3'
Test #14:
score: 14
Accepted
time: 1ms
memory: 5624kb
input:
5 2 111111111 888888888 555555555 222222222 444444444
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Wrong Answer
time: 1ms
memory: 5572kb
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%