QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#731371#5585. Creative Accountingbeamishboys#WA 7ms3820kbC++23606b2024-11-10 02:44:212024-11-10 02:44:21

Judging History

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

  • [2024-11-10 02:44:21]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:3820kb
  • [2024-11-10 02:44:21]
  • 提交

answer

#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
const ll mn = 3e4+5;

ll dp1[mn], psum[mn];
ll dp2[mn];
int main() {
	int n, l, h; cin >> n >> l >> h;
	for (int i = 1; i <= n; i++) {
		cin >> psum[i];
		psum[i] += psum[i-1];
		dp1[i] = 1e9;
	}

	for (int i = 1; i <= n; i++) {
		for (int j = max(i-h, 0); j == 0 || (j <= i-l) || (i == n && j < n); j++) {
			if (j < 0) continue;
			ll s = psum[i] - psum[j];
			dp1[i] = min(dp1[i], dp1[j] + (s > 0));
			dp2[i] = max(dp2[i], dp2[j] + (s > 0));
		}
	}

	cout << dp1[n] << ' ' << dp2[n] << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3692kb

input:

10 3 5
3
2
-7
5
4
1
3
0
-3
5

output:

2 4

result:

ok single line: '2 4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1 1 1
1

output:

1 1

result:

ok single line: '1 1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

3 1 3
3
3
3

output:

1 3

result:

ok single line: '1 3'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

10 1 5
0
0
0
0
0
0
0
0
0
0

output:

0 0

result:

ok single line: '0 0'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

60 1 20
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-10000
-1000...

output:

0 0

result:

ok single line: '0 0'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

5000 1 1
10000
9998
9996
9994
9992
9990
9988
9986
9984
9982
9980
9978
9976
9974
9972
9970
9968
9966
9964
9962
9960
9958
9956
9954
9952
9950
9948
9946
9944
9942
9940
9938
9936
9934
9932
9930
9928
9926
9924
9922
9920
9918
9916
9914
9912
9910
9908
9906
9904
9902
9900
9898
9896
9894
9892
9890
9888
9886
...

output:

5000 5000

result:

ok single line: '5000 5000'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

5000 1 2
-10000
-9998
-9996
-9994
-9992
-9990
-9988
-9986
-9984
-9982
-9980
-9978
-9976
-9974
-9972
-9970
-9968
-9966
-9964
-9962
-9960
-9958
-9956
-9954
-9952
-9950
-9948
-9946
-9944
-9942
-9940
-9938
-9936
-9934
-9932
-9930
-9928
-9926
-9924
-9922
-9920
-9918
-9916
-9914
-9912
-9910
-9908
-9906
-9...

output:

0 0

result:

ok single line: '0 0'

Test #8:

score: 0
Accepted
time: 7ms
memory: 3812kb

input:

5000 1 500
0
1
-2
3
-4
5
-6
7
-8
9
-10
11
-12
13
-14
15
-16
17
-18
19
-20
21
-22
23
-24
25
-26
27
-28
29
-30
31
-32
33
-34
35
-36
37
-38
39
-40
41
-42
43
-44
45
-46
47
-48
49
-50
51
-52
53
-54
55
-56
57
-58
59
-60
61
-62
63
-64
65
-66
67
-68
69
-70
71
-72
73
-74
75
-76
77
-78
79
-80
81
-82
83
-84
85...

output:

2 2501

result:

ok single line: '2 2501'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3800kb

input:

5000 1 10
0
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100
102
104
106
108
110
112
114
116
118
120
122
124
126
128
130
132
134
136
138
140
142
144
146
148
150
152
154
156
158
160
162
164
166
168
170
1...

output:

500 4998

result:

ok single line: '500 4998'

Test #10:

score: -100
Wrong Answer
time: 1ms
memory: 3752kb

input:

5000 321 327
-10
3
0
-4
2
9
8
9
-10
-6
-8
-10
-10
9
6
2
3
-6
-4
-7
-1
-2
3
9
-2
3
0
0
4
-7
-2
6
1
8
0
-8
0
3
-5
0
-4
-2
1
5
-10
-2
7
-1
-8
2
6
9
-2
2
5
7
8
7
-3
3
8
-3
-7
-4
6
-4
4
1
6
7
-10
-8
5
-9
4
-2
8
-3
-8
-9
-7
7
-3
-4
8
5
-4
-7
0
5
1
6
-4
4
9
-9
1
0
4
-2
-4
-2
-10
9
4
9
7
-4
-6
9
9
6
7
3
-1
...

output:

0 6

result:

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