mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2025-02-17 13:26:47 +00:00
parent
964ead51b2
commit
bd08e79678
58
S2OJ/1589/1589.cpp
Normal file
58
S2OJ/1589/1589.cpp
Normal 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
BIN
S2OJ/1589/data/run9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user