From bd08e79678eaace7addb5230d0baecf6355c7ef7 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Sun, 25 Sep 2022 20:53:06 +0800 Subject: [PATCH] =?UTF-8?q?#1589.=20=E3=80=902022.09.24=20=E6=A8=A1?= =?UTF-8?q?=E6=8B=9F=E8=B5=9B=E3=80=91=E8=B7=91=E6=AD=A5=EF=BC=88run?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/57855 --- S2OJ/1589/1589.cpp | 58 +++++++++++++++++++++++++++++++++++++ S2OJ/1589/data/problem.conf | 3 ++ S2OJ/1589/data/run1.in | 3 ++ S2OJ/1589/data/run1.out | 3 ++ S2OJ/1589/data/run10.in | 3 ++ S2OJ/1589/data/run10.out | 3 ++ S2OJ/1589/data/run2.in | 3 ++ S2OJ/1589/data/run2.out | 3 ++ S2OJ/1589/data/run3.in | 3 ++ S2OJ/1589/data/run3.out | 3 ++ S2OJ/1589/data/run4.in | 3 ++ S2OJ/1589/data/run4.out | 3 ++ S2OJ/1589/data/run5.in | 3 ++ S2OJ/1589/data/run5.out | 3 ++ S2OJ/1589/data/run6.in | 3 ++ S2OJ/1589/data/run6.out | 3 ++ S2OJ/1589/data/run7.in | 3 ++ S2OJ/1589/data/run7.out | 3 ++ S2OJ/1589/data/run8.in | 3 ++ S2OJ/1589/data/run8.out | 3 ++ S2OJ/1589/data/run9.in | 3 ++ S2OJ/1589/data/run9.out | 3 ++ 22 files changed, 121 insertions(+) create mode 100644 S2OJ/1589/1589.cpp create mode 100644 S2OJ/1589/data/problem.conf create mode 100644 S2OJ/1589/data/run1.in create mode 100644 S2OJ/1589/data/run1.out create mode 100644 S2OJ/1589/data/run10.in create mode 100644 S2OJ/1589/data/run10.out create mode 100644 S2OJ/1589/data/run2.in create mode 100644 S2OJ/1589/data/run2.out create mode 100644 S2OJ/1589/data/run3.in create mode 100644 S2OJ/1589/data/run3.out create mode 100644 S2OJ/1589/data/run4.in create mode 100644 S2OJ/1589/data/run4.out create mode 100644 S2OJ/1589/data/run5.in create mode 100644 S2OJ/1589/data/run5.out create mode 100644 S2OJ/1589/data/run6.in create mode 100644 S2OJ/1589/data/run6.out create mode 100644 S2OJ/1589/data/run7.in create mode 100644 S2OJ/1589/data/run7.out create mode 100644 S2OJ/1589/data/run8.in create mode 100644 S2OJ/1589/data/run8.out create mode 100644 S2OJ/1589/data/run9.in create mode 100644 S2OJ/1589/data/run9.out diff --git a/S2OJ/1589/1589.cpp b/S2OJ/1589/1589.cpp new file mode 100644 index 00000000..7df2e1f8 --- /dev/null +++ b/S2OJ/1589/1589.cpp @@ -0,0 +1,58 @@ +#include +#include + +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::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; +} diff --git a/S2OJ/1589/data/problem.conf b/S2OJ/1589/data/problem.conf new file mode 100644 index 00000000..b734f210 --- /dev/null +++ b/S2OJ/1589/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:709fe0a52364759f42fa07efc03c8ea1c099bbd05f490e6d892bfc8654fb296e +size 175 diff --git a/S2OJ/1589/data/run1.in b/S2OJ/1589/data/run1.in new file mode 100644 index 00000000..b7b4577e --- /dev/null +++ b/S2OJ/1589/data/run1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fa4d299b26c39da0416e616f33f09c97f3221750ea768303132e2fca767bd84 +size 2506 diff --git a/S2OJ/1589/data/run1.out b/S2OJ/1589/data/run1.out new file mode 100644 index 00000000..7c7da43e --- /dev/null +++ b/S2OJ/1589/data/run1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:872c15ed8b48e3a9e88a61b329cf0e220d21e5c994b0583cbebe49281759244e +size 256 diff --git a/S2OJ/1589/data/run10.in b/S2OJ/1589/data/run10.in new file mode 100644 index 00000000..0874a887 --- /dev/null +++ b/S2OJ/1589/data/run10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e84f00488c516c39ee12046b2b0ab24f7d67d60fac4ee6f38119ddd810bed9b +size 24980005 diff --git a/S2OJ/1589/data/run10.out b/S2OJ/1589/data/run10.out new file mode 100644 index 00000000..e94fd878 --- /dev/null +++ b/S2OJ/1589/data/run10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dffa16f35b2c0d88be1b12ef3f5abab06cb173ebeb50ae1fd6b56858bd437e96 +size 30041 diff --git a/S2OJ/1589/data/run2.in b/S2OJ/1589/data/run2.in new file mode 100644 index 00000000..34408d11 --- /dev/null +++ b/S2OJ/1589/data/run2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af75ece099621f7cc12849bd4a90ab03b227d6407c6858e417f453997c362faa +size 2505 diff --git a/S2OJ/1589/data/run2.out b/S2OJ/1589/data/run2.out new file mode 100644 index 00000000..99acd50c --- /dev/null +++ b/S2OJ/1589/data/run2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f99179284330a5802a5259c08901f03984c39f8effd85e097fec91029dac3a06 +size 228 diff --git a/S2OJ/1589/data/run3.in b/S2OJ/1589/data/run3.in new file mode 100644 index 00000000..aeadbd84 --- /dev/null +++ b/S2OJ/1589/data/run3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c43952535be84a9728ec366ea7c6c2d999cb2bd32734c07dfe969cd89c87e992 +size 250008 diff --git a/S2OJ/1589/data/run3.out b/S2OJ/1589/data/run3.out new file mode 100644 index 00000000..d5752572 --- /dev/null +++ b/S2OJ/1589/data/run3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f081b1034661ca27b2dadef12ce006d7e63833603f7ff1f99a9bb6a16a09adb5 +size 2640 diff --git a/S2OJ/1589/data/run4.in b/S2OJ/1589/data/run4.in new file mode 100644 index 00000000..b79befd3 --- /dev/null +++ b/S2OJ/1589/data/run4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:787b1ada78cd23f19381cb89ed27ea280983acf2300693ea818abbc6f55a4cb6 +size 250007 diff --git a/S2OJ/1589/data/run4.out b/S2OJ/1589/data/run4.out new file mode 100644 index 00000000..32f8f94c --- /dev/null +++ b/S2OJ/1589/data/run4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87d1b3f2f090590b2478cd9253a6a218ab17a5b3b5ad442ec80d0f7208a0b4b0 +size 2184 diff --git a/S2OJ/1589/data/run5.in b/S2OJ/1589/data/run5.in new file mode 100644 index 00000000..b25aa75b --- /dev/null +++ b/S2OJ/1589/data/run5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5075aa3cdbe55a7d6cdf801cbafbb5b56496941dce2b496b086cc84c04eedd8b +size 4000010 diff --git a/S2OJ/1589/data/run5.out b/S2OJ/1589/data/run5.out new file mode 100644 index 00000000..a01ebe99 --- /dev/null +++ b/S2OJ/1589/data/run5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cd77c0ac5e18c5864a2a55ff8acfadd43ce35940f508be55e8eb6c6c7309b7ec +size 9170 diff --git a/S2OJ/1589/data/run6.in b/S2OJ/1589/data/run6.in new file mode 100644 index 00000000..76102f64 --- /dev/null +++ b/S2OJ/1589/data/run6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0aece47fc0359ba7a8202d8459ee7ecfc79ef0c142f9dc0428dbf2be479c724 +size 4000009 diff --git a/S2OJ/1589/data/run6.out b/S2OJ/1589/data/run6.out new file mode 100644 index 00000000..d4152356 --- /dev/null +++ b/S2OJ/1589/data/run6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7bf921c6264e896060053a692e4f611859e2d0b69f6002f543a28736da3b49a2 +size 8306 diff --git a/S2OJ/1589/data/run7.in b/S2OJ/1589/data/run7.in new file mode 100644 index 00000000..b30d56df --- /dev/null +++ b/S2OJ/1589/data/run7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50239f57057920ac55edc69e926f5c28e4e8506d3c4e2b26ed182d360119b61c +size 4000010 diff --git a/S2OJ/1589/data/run7.out b/S2OJ/1589/data/run7.out new file mode 100644 index 00000000..3fc4a9e8 --- /dev/null +++ b/S2OJ/1589/data/run7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:181191bfb8ef12e4e137977d0fb9d0aac3e3e8f9c862e86a33c0909eb62c2a0f +size 9618 diff --git a/S2OJ/1589/data/run8.in b/S2OJ/1589/data/run8.in new file mode 100644 index 00000000..d252dd6b --- /dev/null +++ b/S2OJ/1589/data/run8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c297612b89ddf11a340bd465aac0fb357721372cdb4ee01368a24dd8d8ce81bc +size 4000009 diff --git a/S2OJ/1589/data/run8.out b/S2OJ/1589/data/run8.out new file mode 100644 index 00000000..6d6e80a4 --- /dev/null +++ b/S2OJ/1589/data/run8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98d9021a92692a4a409d1bd760c8acc2a3b5c8d6be6fba6b3aeb00e235d4c3d5 +size 9973 diff --git a/S2OJ/1589/data/run9.in b/S2OJ/1589/data/run9.in new file mode 100644 index 00000000..0b44ff8c --- /dev/null +++ b/S2OJ/1589/data/run9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9247cfbe119fce3d438d1d5a67bf87f030a14c6469944814a838d1154533eb9 +size 24980010 diff --git a/S2OJ/1589/data/run9.out b/S2OJ/1589/data/run9.out new file mode 100644 index 00000000..7bd2e5de --- /dev/null +++ b/S2OJ/1589/data/run9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6dea9d4583f632ee17b3542b2d229cfc7753e1fd3693b586daf2e687f595b2da +size 30068