0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 18:08:47 +00:00

1470. 【2022.7.11】饥饿的小鸟(river)

https://sjzezoj.com/submission/53621
This commit is contained in:
Baoshuo Ren 2022-07-11 15:03:22 +08:00
parent 9df2203d05
commit 6b2c7a391e
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
22 changed files with 108 additions and 0 deletions

45
S2OJ/1470/1470.cpp Normal file
View File

@ -0,0 +1,45 @@
#include <iostream>
#include <cstring>
#include <limits>
#include <queue>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e5 + 5;
int n, l, s, a[N], b[N];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> l;
for (int i = 1; i < n; i++) {
cin >> a[i];
s += a[i];
}
a[n] = b[0] = s;
for (int i = 0; i < n; i++) {
for (int j = std::min(i + l, n); j > i; j--) {
if (b[j] < a[j]) {
if (b[j] + b[i] <= a[j]) {
b[j] += b[i];
b[i] = 0;
break;
} else {
b[i] -= a[j] - b[j];
b[j] = a[j];
}
}
}
}
cout << b[n] << endl;
return 0;
}

BIN
S2OJ/1470/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1470/data/river9.out (Stored with Git LFS) Normal file

Binary file not shown.