QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#731370#5585. Creative Accountingbeamishboys#WA 0ms3700kbC++23608b2024-11-10 02:43:562024-11-10 02:43:57

Judging History

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

  • [2024-11-10 02:43:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2024-11-10 02:43:56]
  • 提交

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

详细

Test #1:

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

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

input:

1 1 1
1

output:

1 1

result:

ok single line: '1 1'

Test #3:

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

input:

3 1 3
3
3
3

output:

1 3

result:

ok single line: '1 3'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3632kb

input:

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

output:

2 10

result:

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