QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#731370 | #5585. Creative Accounting | beamishboys# | WA | 0ms | 3700kb | C++23 | 608b | 2024-11-10 02:43:56 | 2024-11-10 02:43:57 |
Judging History
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: 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'