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

#1589. 【2022.09.24 模拟赛】跑步(run)

https://sjzezoj.com/submission/57855
This commit is contained in:
Baoshuo Ren 2022-09-25 20:53:06 +08:00
parent 964ead51b2
commit bd08e79678
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
22 changed files with 121 additions and 0 deletions

58
S2OJ/1589/1589.cpp Normal file
View File

@ -0,0 +1,58 @@
#include <iostream>
#include <limits>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 5005;
int n, m, c[N], st[N], mx[N], ans[N << 1];
bool g[N][N];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
char c;
cin >> c;
g[i][j] = c == '#';
}
}
for (int i = 1; i <= n; i++) {
int top = 0;
st[0] = 0;
mx[0] = std::numeric_limits<int>::min();
for (int j = 1; j <= m; j++) {
if (g[i][j]) c[j] = 0;
else c[j]++;
}
for (int j = 1; j <= m; j++) {
while (top && c[st[top]] >= c[j]) top--;
if (c[j] == 0) {
st[0] = j;
} else {
st[++top] = j;
mx[top] = std::max(mx[top - 1], c[st[top]] - st[top - 1]);
if (!g[i][j]) ans[j + mx[top]]++;
}
}
}
for (int i = 1; i <= n + m; i++) {
cout << ans[i] << ' ';
}
return 0;
}

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

Binary file not shown.

BIN
S2OJ/1589/data/run1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1589/data/run9.out (Stored with Git LFS) Normal file

Binary file not shown.