From b4b5c2040ef99087e9d4eff0abf41cb06abfe49a Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 14 Sep 2022 15:38:17 +0800 Subject: [PATCH] =?UTF-8?q?#1558.=20=E3=80=902022.9.14=20=E8=81=94?= =?UTF-8?q?=E8=80=83=E3=80=913aab198230b8fd9f?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/56419 --- S2OJ/1558/1558.cpp | 39 +++++++++++++++++++++++++++++++++++++ S2OJ/1558/data/mdv1.in | 3 +++ S2OJ/1558/data/mdv1.out | 3 +++ S2OJ/1558/data/mdv10.in | 3 +++ S2OJ/1558/data/mdv10.out | 3 +++ S2OJ/1558/data/mdv11.in | 3 +++ S2OJ/1558/data/mdv11.out | 3 +++ S2OJ/1558/data/mdv12.in | 3 +++ S2OJ/1558/data/mdv12.out | 3 +++ S2OJ/1558/data/mdv13.in | 3 +++ S2OJ/1558/data/mdv13.out | 3 +++ S2OJ/1558/data/mdv14.in | 3 +++ S2OJ/1558/data/mdv14.out | 3 +++ S2OJ/1558/data/mdv15.in | 3 +++ S2OJ/1558/data/mdv15.out | 3 +++ S2OJ/1558/data/mdv16.in | 3 +++ S2OJ/1558/data/mdv16.out | 3 +++ S2OJ/1558/data/mdv17.in | 3 +++ S2OJ/1558/data/mdv17.out | 3 +++ S2OJ/1558/data/mdv18.in | 3 +++ S2OJ/1558/data/mdv18.out | 3 +++ S2OJ/1558/data/mdv19.in | 3 +++ S2OJ/1558/data/mdv19.out | 3 +++ S2OJ/1558/data/mdv2.in | 3 +++ S2OJ/1558/data/mdv2.out | 3 +++ S2OJ/1558/data/mdv20.in | 3 +++ S2OJ/1558/data/mdv20.out | 3 +++ S2OJ/1558/data/mdv3.in | 3 +++ S2OJ/1558/data/mdv3.out | 3 +++ S2OJ/1558/data/mdv4.in | 3 +++ S2OJ/1558/data/mdv4.out | 3 +++ S2OJ/1558/data/mdv5.in | 3 +++ S2OJ/1558/data/mdv5.out | 3 +++ S2OJ/1558/data/mdv6.in | 3 +++ S2OJ/1558/data/mdv6.out | 3 +++ S2OJ/1558/data/mdv7.in | 3 +++ S2OJ/1558/data/mdv7.out | 3 +++ S2OJ/1558/data/mdv8.in | 3 +++ S2OJ/1558/data/mdv8.out | 3 +++ S2OJ/1558/data/mdv9.in | 3 +++ S2OJ/1558/data/mdv9.out | 3 +++ S2OJ/1558/data/problem.conf | 3 +++ 42 files changed, 162 insertions(+) create mode 100644 S2OJ/1558/1558.cpp create mode 100644 S2OJ/1558/data/mdv1.in create mode 100644 S2OJ/1558/data/mdv1.out create mode 100644 S2OJ/1558/data/mdv10.in create mode 100644 S2OJ/1558/data/mdv10.out create mode 100644 S2OJ/1558/data/mdv11.in create mode 100644 S2OJ/1558/data/mdv11.out create mode 100644 S2OJ/1558/data/mdv12.in create mode 100644 S2OJ/1558/data/mdv12.out create mode 100644 S2OJ/1558/data/mdv13.in create mode 100644 S2OJ/1558/data/mdv13.out create mode 100644 S2OJ/1558/data/mdv14.in create mode 100644 S2OJ/1558/data/mdv14.out create mode 100644 S2OJ/1558/data/mdv15.in create mode 100644 S2OJ/1558/data/mdv15.out create mode 100644 S2OJ/1558/data/mdv16.in create mode 100644 S2OJ/1558/data/mdv16.out create mode 100644 S2OJ/1558/data/mdv17.in create mode 100644 S2OJ/1558/data/mdv17.out create mode 100644 S2OJ/1558/data/mdv18.in create mode 100644 S2OJ/1558/data/mdv18.out create mode 100644 S2OJ/1558/data/mdv19.in create mode 100644 S2OJ/1558/data/mdv19.out create mode 100644 S2OJ/1558/data/mdv2.in create mode 100644 S2OJ/1558/data/mdv2.out create mode 100644 S2OJ/1558/data/mdv20.in create mode 100644 S2OJ/1558/data/mdv20.out create mode 100644 S2OJ/1558/data/mdv3.in create mode 100644 S2OJ/1558/data/mdv3.out create mode 100644 S2OJ/1558/data/mdv4.in create mode 100644 S2OJ/1558/data/mdv4.out create mode 100644 S2OJ/1558/data/mdv5.in create mode 100644 S2OJ/1558/data/mdv5.out create mode 100644 S2OJ/1558/data/mdv6.in create mode 100644 S2OJ/1558/data/mdv6.out create mode 100644 S2OJ/1558/data/mdv7.in create mode 100644 S2OJ/1558/data/mdv7.out create mode 100644 S2OJ/1558/data/mdv8.in create mode 100644 S2OJ/1558/data/mdv8.out create mode 100644 S2OJ/1558/data/mdv9.in create mode 100644 S2OJ/1558/data/mdv9.out create mode 100644 S2OJ/1558/data/problem.conf diff --git a/S2OJ/1558/1558.cpp b/S2OJ/1558/1558.cpp new file mode 100644 index 00000000..436e8d04 --- /dev/null +++ b/S2OJ/1558/1558.cpp @@ -0,0 +1,39 @@ +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e6 + 5; + +int n, m, a[N]; +long long ans; +std::unordered_set set; +std::unordered_map map; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n >> m; + + for (int i = 1; i <= n; i++) { + cin >> a[i]; + } + + for (int i = 1, j = 0; i <= n - m + 1; i++) { + while (j < n && set.size() < m) { + set.insert(a[++j]); + map[a[j]]++; + } + + if (set.size() == m) ans += n - j + 1; + if (!--map[a[i]]) set.erase(a[i]); + } + + cout << ans << endl; + + return 0; +} diff --git a/S2OJ/1558/data/mdv1.in b/S2OJ/1558/data/mdv1.in new file mode 100644 index 00000000..941dceaa --- /dev/null +++ b/S2OJ/1558/data/mdv1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5a5146319afedf107cac6a1619eec0a1a7917eeeb859813110126fc366945bf4 +size 43 diff --git a/S2OJ/1558/data/mdv1.out b/S2OJ/1558/data/mdv1.out new file mode 100644 index 00000000..d2bb1a39 --- /dev/null +++ b/S2OJ/1558/data/mdv1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90d7ec0f0acef104d8b6252794295f661a0149634868d02a1ae0c358099638f5 +size 3 diff --git a/S2OJ/1558/data/mdv10.in b/S2OJ/1558/data/mdv10.in new file mode 100644 index 00000000..e8a5c868 --- /dev/null +++ b/S2OJ/1558/data/mdv10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b64ce89aea2cd6e9d68d79d0431abae70c8c3e318d464ce3aebd6da9e7043440 +size 6805156 diff --git a/S2OJ/1558/data/mdv10.out b/S2OJ/1558/data/mdv10.out new file mode 100644 index 00000000..38118f32 --- /dev/null +++ b/S2OJ/1558/data/mdv10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:53c234e5e8472b6ac51c1ae1cab3fe06fad053beb8ebfd8977b010655bfdd3c3 +size 2 diff --git a/S2OJ/1558/data/mdv11.in b/S2OJ/1558/data/mdv11.in new file mode 100644 index 00000000..c090d5ba --- /dev/null +++ b/S2OJ/1558/data/mdv11.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9239d6a9a607e964e558c7040525807dfa237e9655ddc4d8a57be29e2b6c292c +size 4598394 diff --git a/S2OJ/1558/data/mdv11.out b/S2OJ/1558/data/mdv11.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/1558/data/mdv11.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/1558/data/mdv12.in b/S2OJ/1558/data/mdv12.in new file mode 100644 index 00000000..103740bc --- /dev/null +++ b/S2OJ/1558/data/mdv12.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f092831008c99ca9c46bd018a26a64c475dcbfd95d579cca4a73c9b0c1728875 +size 5544992 diff --git a/S2OJ/1558/data/mdv12.out b/S2OJ/1558/data/mdv12.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/1558/data/mdv12.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/1558/data/mdv13.in b/S2OJ/1558/data/mdv13.in new file mode 100644 index 00000000..5d3841f7 --- /dev/null +++ b/S2OJ/1558/data/mdv13.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:773f9a4b4a9b5a82db9ef2aed9c148b14e5f06d00d176831c26077868e8eda96 +size 3756055 diff --git a/S2OJ/1558/data/mdv13.out b/S2OJ/1558/data/mdv13.out new file mode 100644 index 00000000..056d5600 --- /dev/null +++ b/S2OJ/1558/data/mdv13.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c16bbfb0686c0ae7d5178b04ae8c14b614e418cb0749dbbdad0d12e28151844 +size 13 diff --git a/S2OJ/1558/data/mdv14.in b/S2OJ/1558/data/mdv14.in new file mode 100644 index 00000000..35e04fe0 --- /dev/null +++ b/S2OJ/1558/data/mdv14.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:011203f0981c151671b187d5413dca1902e321c140c0e525db4ea2f956d20401 +size 4016288 diff --git a/S2OJ/1558/data/mdv14.out b/S2OJ/1558/data/mdv14.out new file mode 100644 index 00000000..98ea4a15 --- /dev/null +++ b/S2OJ/1558/data/mdv14.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c4c8f003c71ca828da55b956eedd43b90bb541312515c70cc947c5b6653c361 +size 13 diff --git a/S2OJ/1558/data/mdv15.in b/S2OJ/1558/data/mdv15.in new file mode 100644 index 00000000..d2aa6df0 --- /dev/null +++ b/S2OJ/1558/data/mdv15.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0b77b5e742727c57763bcab592c51c1e1a023388a30d51c8b4b00a7d0531d92 +size 3385431 diff --git a/S2OJ/1558/data/mdv15.out b/S2OJ/1558/data/mdv15.out new file mode 100644 index 00000000..5798c7e3 --- /dev/null +++ b/S2OJ/1558/data/mdv15.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8007ad37f95dead6c70a9d484a5cd53fcc7f577c8b1071b01068c6d02b1006a8 +size 13 diff --git a/S2OJ/1558/data/mdv16.in b/S2OJ/1558/data/mdv16.in new file mode 100644 index 00000000..10bf1d23 --- /dev/null +++ b/S2OJ/1558/data/mdv16.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:125b7a2c4814f7d96b8aaac6be660e90dbb6759ff16fd337d37572dd5bc75f8f +size 4735025 diff --git a/S2OJ/1558/data/mdv16.out b/S2OJ/1558/data/mdv16.out new file mode 100644 index 00000000..27d3c36c --- /dev/null +++ b/S2OJ/1558/data/mdv16.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b03e3f959fe63d012bed7476bcb191f23940c8d2b00d7760505c9587f52395f +size 13 diff --git a/S2OJ/1558/data/mdv17.in b/S2OJ/1558/data/mdv17.in new file mode 100644 index 00000000..74ce64e6 --- /dev/null +++ b/S2OJ/1558/data/mdv17.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d0c751d796879ce2facbc6d11c4766731178275e6425ecf4bdd5321541d739f +size 5329156 diff --git a/S2OJ/1558/data/mdv17.out b/S2OJ/1558/data/mdv17.out new file mode 100644 index 00000000..c62bf632 --- /dev/null +++ b/S2OJ/1558/data/mdv17.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:550d8350f9de3c2a5c71571dd01d41acc412a2a1e2c8df7215a318241c1a3e92 +size 13 diff --git a/S2OJ/1558/data/mdv18.in b/S2OJ/1558/data/mdv18.in new file mode 100644 index 00000000..7ac10153 --- /dev/null +++ b/S2OJ/1558/data/mdv18.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7200528cb7104df601476c0c49760991c0bca246512f485f1331b1d70f54caca +size 5312109 diff --git a/S2OJ/1558/data/mdv18.out b/S2OJ/1558/data/mdv18.out new file mode 100644 index 00000000..b3e83496 --- /dev/null +++ b/S2OJ/1558/data/mdv18.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9dfa581e86031f18acc0ddb53074cea906c6b2101f064d3438fde939aa687455 +size 13 diff --git a/S2OJ/1558/data/mdv19.in b/S2OJ/1558/data/mdv19.in new file mode 100644 index 00000000..d7f3ea38 --- /dev/null +++ b/S2OJ/1558/data/mdv19.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e6836409d1af7b527de5f70d5870be48bb61f644f892bc5e12c4c475c3dabcc +size 4918763 diff --git a/S2OJ/1558/data/mdv19.out b/S2OJ/1558/data/mdv19.out new file mode 100644 index 00000000..cfe38c3b --- /dev/null +++ b/S2OJ/1558/data/mdv19.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8198d0f2a7a5747e5725ce53ce2ab1340650a5dc2f016ebb7841dd96162dc22b +size 13 diff --git a/S2OJ/1558/data/mdv2.in b/S2OJ/1558/data/mdv2.in new file mode 100644 index 00000000..4f65dcbc --- /dev/null +++ b/S2OJ/1558/data/mdv2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68c452781dc5b876aa8c4b8cb75efaa0487950e3122b569b526170c59c82322a +size 132 diff --git a/S2OJ/1558/data/mdv2.out b/S2OJ/1558/data/mdv2.out new file mode 100644 index 00000000..a5a189ec --- /dev/null +++ b/S2OJ/1558/data/mdv2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:626e40367602fe56cb5b14c1df78f2b5c043b44e415d64c89d0d980492e42588 +size 4 diff --git a/S2OJ/1558/data/mdv20.in b/S2OJ/1558/data/mdv20.in new file mode 100644 index 00000000..8d5e89ee --- /dev/null +++ b/S2OJ/1558/data/mdv20.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:70d129d9976750e11216c3e14c4e0fe58bff4f7f3af43fb99a2dfdd9eac4d91b +size 5059904 diff --git a/S2OJ/1558/data/mdv20.out b/S2OJ/1558/data/mdv20.out new file mode 100644 index 00000000..812df6f6 --- /dev/null +++ b/S2OJ/1558/data/mdv20.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c683a7c7cdc34f6937fa4e4873f7787ca43a2a4413170a3687a7ea533ca43ac +size 13 diff --git a/S2OJ/1558/data/mdv3.in b/S2OJ/1558/data/mdv3.in new file mode 100644 index 00000000..25b69217 --- /dev/null +++ b/S2OJ/1558/data/mdv3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a3b0df75ba79a13b756e3250969611e56a21b1093dd5b6dc7f83c1efebb9c77 +size 3272 diff --git a/S2OJ/1558/data/mdv3.out b/S2OJ/1558/data/mdv3.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/1558/data/mdv3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/1558/data/mdv4.in b/S2OJ/1558/data/mdv4.in new file mode 100644 index 00000000..d51abc9d --- /dev/null +++ b/S2OJ/1558/data/mdv4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0aa7d4d7f6b66335131ad86ef76b723a044b192bed9a3cbcede74dcea9ebf043 +size 3110 diff --git a/S2OJ/1558/data/mdv4.out b/S2OJ/1558/data/mdv4.out new file mode 100644 index 00000000..cb90f684 --- /dev/null +++ b/S2OJ/1558/data/mdv4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06e9d52c1720fca412803e3b07c4b228ff113e303f4c7ab94665319d832bbfb7 +size 2 diff --git a/S2OJ/1558/data/mdv5.in b/S2OJ/1558/data/mdv5.in new file mode 100644 index 00000000..bc466421 --- /dev/null +++ b/S2OJ/1558/data/mdv5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67bc9dff77802dfe3f0c6f2384d5eb3cebde932826d73365a648046e8ee4d8cb +size 3344 diff --git a/S2OJ/1558/data/mdv5.out b/S2OJ/1558/data/mdv5.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/1558/data/mdv5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/1558/data/mdv6.in b/S2OJ/1558/data/mdv6.in new file mode 100644 index 00000000..61a57480 --- /dev/null +++ b/S2OJ/1558/data/mdv6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65981814446d3ad351078acfd06d4f3fa0e014879fe5215690871f28fd4ddc71 +size 2955 diff --git a/S2OJ/1558/data/mdv6.out b/S2OJ/1558/data/mdv6.out new file mode 100644 index 00000000..ca267b30 --- /dev/null +++ b/S2OJ/1558/data/mdv6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1121cfccd5913f0a63fec40a6ffd44ea64f9dc135c66634ba001d10bcf4302a2 +size 2 diff --git a/S2OJ/1558/data/mdv7.in b/S2OJ/1558/data/mdv7.in new file mode 100644 index 00000000..61d1f9f3 --- /dev/null +++ b/S2OJ/1558/data/mdv7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3cdb2445b158d28bac9f17faec023e58f6a00c1aa15b06800ef22acef055a1ca +size 5977666 diff --git a/S2OJ/1558/data/mdv7.out b/S2OJ/1558/data/mdv7.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/1558/data/mdv7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/1558/data/mdv8.in b/S2OJ/1558/data/mdv8.in new file mode 100644 index 00000000..9a0b5406 --- /dev/null +++ b/S2OJ/1558/data/mdv8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81b3105bc752423752d35f076c50ebb4d3bf4ac85925538298094e3e8cc79127 +size 6445904 diff --git a/S2OJ/1558/data/mdv8.out b/S2OJ/1558/data/mdv8.out new file mode 100644 index 00000000..06d04c2c --- /dev/null +++ b/S2OJ/1558/data/mdv8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa67a169b0bba217aa0aa88a65346920c84c42447c36ba5f7ea65f422c1fe5d8 +size 2 diff --git a/S2OJ/1558/data/mdv9.in b/S2OJ/1558/data/mdv9.in new file mode 100644 index 00000000..4da733e9 --- /dev/null +++ b/S2OJ/1558/data/mdv9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c932ceada6fc608f23d411cc87d149dce423b8b2b37521c0de9c2762de789aff +size 6163742 diff --git a/S2OJ/1558/data/mdv9.out b/S2OJ/1558/data/mdv9.out new file mode 100644 index 00000000..1afab5f7 --- /dev/null +++ b/S2OJ/1558/data/mdv9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4355a46b19d348dc2f57c046f8ef63d4538ebb936000f3c9ee954a27460dd865 +size 2 diff --git a/S2OJ/1558/data/problem.conf b/S2OJ/1558/data/problem.conf new file mode 100644 index 00000000..b8aeeeb5 --- /dev/null +++ b/S2OJ/1558/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:02a2467f8b5d561924a978ad37e6ed993dd41fc15a10a15621dbe869e95cc528 +size 175