From 7e9e0be909e6887fa98dece672e6a8dcc0c30a4f Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 9 Jun 2022 17:06:31 +0800 Subject: [PATCH] =?UTF-8?q?#2593.=20=E3=80=8CNOIP2010=E3=80=8D=E4=B9=8C?= =?UTF-8?q?=E9=BE=9F=E6=A3=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://loj.ac/s/1479126 --- LibreOJ/2593/2593.cpp | 45 ++++++++++++++++++++++++++++++++ LibreOJ/2593/data/tortoise1.ans | 3 +++ LibreOJ/2593/data/tortoise1.in | 3 +++ LibreOJ/2593/data/tortoise10.ans | 3 +++ LibreOJ/2593/data/tortoise10.in | 3 +++ LibreOJ/2593/data/tortoise2.ans | 3 +++ LibreOJ/2593/data/tortoise2.in | 3 +++ LibreOJ/2593/data/tortoise3.ans | 3 +++ LibreOJ/2593/data/tortoise3.in | 3 +++ LibreOJ/2593/data/tortoise4.ans | 3 +++ LibreOJ/2593/data/tortoise4.in | 3 +++ LibreOJ/2593/data/tortoise5.ans | 3 +++ LibreOJ/2593/data/tortoise5.in | 3 +++ LibreOJ/2593/data/tortoise6.ans | 3 +++ LibreOJ/2593/data/tortoise6.in | 3 +++ LibreOJ/2593/data/tortoise7.ans | 3 +++ LibreOJ/2593/data/tortoise7.in | 3 +++ LibreOJ/2593/data/tortoise8.ans | 3 +++ LibreOJ/2593/data/tortoise8.in | 3 +++ LibreOJ/2593/data/tortoise9.ans | 3 +++ LibreOJ/2593/data/tortoise9.in | 3 +++ 21 files changed, 105 insertions(+) create mode 100644 LibreOJ/2593/2593.cpp create mode 100644 LibreOJ/2593/data/tortoise1.ans create mode 100644 LibreOJ/2593/data/tortoise1.in create mode 100644 LibreOJ/2593/data/tortoise10.ans create mode 100644 LibreOJ/2593/data/tortoise10.in create mode 100644 LibreOJ/2593/data/tortoise2.ans create mode 100644 LibreOJ/2593/data/tortoise2.in create mode 100644 LibreOJ/2593/data/tortoise3.ans create mode 100644 LibreOJ/2593/data/tortoise3.in create mode 100644 LibreOJ/2593/data/tortoise4.ans create mode 100644 LibreOJ/2593/data/tortoise4.in create mode 100644 LibreOJ/2593/data/tortoise5.ans create mode 100644 LibreOJ/2593/data/tortoise5.in create mode 100644 LibreOJ/2593/data/tortoise6.ans create mode 100644 LibreOJ/2593/data/tortoise6.in create mode 100644 LibreOJ/2593/data/tortoise7.ans create mode 100644 LibreOJ/2593/data/tortoise7.in create mode 100644 LibreOJ/2593/data/tortoise8.ans create mode 100644 LibreOJ/2593/data/tortoise8.in create mode 100644 LibreOJ/2593/data/tortoise9.ans create mode 100644 LibreOJ/2593/data/tortoise9.in diff --git a/LibreOJ/2593/2593.cpp b/LibreOJ/2593/2593.cpp new file mode 100644 index 00000000..8b2f4ec5 --- /dev/null +++ b/LibreOJ/2593/2593.cpp @@ -0,0 +1,45 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 355, + M = 125; + +int n, m, a[N], b[5], f[M][M][M][M]; + +int main() { + std::ios::sync_with_stdio(false); + + cin >> n >> m; + for (int i = 1; i <= n; i++) { + cin >> a[i]; + } + for (int i = 1, x; i <= m; i++) { + cin >> x; + b[x]++; + } + + f[0][0][0][0] = a[1]; + for (int i = 0; i <= b[1]; i++) { + for (int j = 0; j <= b[2]; j++) { + for (int k = 0; k <= b[3]; k++) { + for (int l = 0; l <= b[4]; l++) { + f[i][j][k][l] = std::max({ + i ? f[i - 1][j][k][l] : 0, + j ? f[i][j - 1][k][l] : 0, + k ? f[i][j][k - 1][l] : 0, + l ? f[i][j][k][l - 1] : 0, + }) + + a[1 + i + j * 2 + k * 3 + l * 4]; + } + } + } + } + + cout << f[b[1]][b[2]][b[3]][b[4]] << endl; + + return 0; +} diff --git a/LibreOJ/2593/data/tortoise1.ans b/LibreOJ/2593/data/tortoise1.ans new file mode 100644 index 00000000..bac957da --- /dev/null +++ b/LibreOJ/2593/data/tortoise1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:053d13be01c62c12cf00285bd279d058f6bd8c3307b6937f55f1729b513ddf92 +size 4 diff --git a/LibreOJ/2593/data/tortoise1.in b/LibreOJ/2593/data/tortoise1.in new file mode 100644 index 00000000..82dc9f91 --- /dev/null +++ b/LibreOJ/2593/data/tortoise1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9a86d3a05fffa8a9ef005843321580c7fadf2f8eed1e322800699a13e9f4b6f +size 52 diff --git a/LibreOJ/2593/data/tortoise10.ans b/LibreOJ/2593/data/tortoise10.ans new file mode 100644 index 00000000..13d01c08 --- /dev/null +++ b/LibreOJ/2593/data/tortoise10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a67967812dfa427a6d30b96cddb4166dd704d74eb678702a73b5144954a7199a +size 5 diff --git a/LibreOJ/2593/data/tortoise10.in b/LibreOJ/2593/data/tortoise10.in new file mode 100644 index 00000000..0db783c0 --- /dev/null +++ b/LibreOJ/2593/data/tortoise10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4444f21c019b27724575bdd4fbd248aa5ba5342670afdd8091edceab382e5d33 +size 1102 diff --git a/LibreOJ/2593/data/tortoise2.ans b/LibreOJ/2593/data/tortoise2.ans new file mode 100644 index 00000000..d6d1a68a --- /dev/null +++ b/LibreOJ/2593/data/tortoise2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8af0215caeb484cef32793849f408d623dea45f2be7ea67c8715f13b2add64fb +size 4 diff --git a/LibreOJ/2593/data/tortoise2.in b/LibreOJ/2593/data/tortoise2.in new file mode 100644 index 00000000..d4a32609 --- /dev/null +++ b/LibreOJ/2593/data/tortoise2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d60af8c40ab3c8c7e16c15c900228510cad312565a4e4ea4dd9347f990233a42 +size 80 diff --git a/LibreOJ/2593/data/tortoise3.ans b/LibreOJ/2593/data/tortoise3.ans new file mode 100644 index 00000000..51579e08 --- /dev/null +++ b/LibreOJ/2593/data/tortoise3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90d75b0127c1a659159e4848167b5a76d370fc572cd6fc0a25917ab2b7a6782b +size 4 diff --git a/LibreOJ/2593/data/tortoise3.in b/LibreOJ/2593/data/tortoise3.in new file mode 100644 index 00000000..2bca65ac --- /dev/null +++ b/LibreOJ/2593/data/tortoise3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca9cffb4406b91bdf76150620d3d4c92683521d2839a5865e7e7d852abbb643b +size 114 diff --git a/LibreOJ/2593/data/tortoise4.ans b/LibreOJ/2593/data/tortoise4.ans new file mode 100644 index 00000000..19926dde --- /dev/null +++ b/LibreOJ/2593/data/tortoise4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42b10fcdc66e847e5c6feb731d586136bee5d499183c952f85d5cd5f166d53b2 +size 5 diff --git a/LibreOJ/2593/data/tortoise4.in b/LibreOJ/2593/data/tortoise4.in new file mode 100644 index 00000000..726a4888 --- /dev/null +++ b/LibreOJ/2593/data/tortoise4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:088266c9f0fa6b9976669ada39a16526dff4fcb8d0413a94f1593747d569c089 +size 226 diff --git a/LibreOJ/2593/data/tortoise5.ans b/LibreOJ/2593/data/tortoise5.ans new file mode 100644 index 00000000..e1908f9c --- /dev/null +++ b/LibreOJ/2593/data/tortoise5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7b32a2eb2026936623c5e38c895e441df1b2b272efe1c249920796faa4100f5 +size 5 diff --git a/LibreOJ/2593/data/tortoise5.in b/LibreOJ/2593/data/tortoise5.in new file mode 100644 index 00000000..45ff9f8c --- /dev/null +++ b/LibreOJ/2593/data/tortoise5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:04a7b5def23d2d21b640b937e9c24eed03c4cdd91a14e209abbc87c00943a4ea +size 426 diff --git a/LibreOJ/2593/data/tortoise6.ans b/LibreOJ/2593/data/tortoise6.ans new file mode 100644 index 00000000..563c7722 --- /dev/null +++ b/LibreOJ/2593/data/tortoise6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad514c9261261ed85f88c234a970ca2b7c9a02318ac1859a143ec06d23d3715d +size 5 diff --git a/LibreOJ/2593/data/tortoise6.in b/LibreOJ/2593/data/tortoise6.in new file mode 100644 index 00000000..de8d64b9 --- /dev/null +++ b/LibreOJ/2593/data/tortoise6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:732b33f67b10266b0295f2692d6f9e6937c3f0bc3423346e1e21d5d272ff2ed1 +size 749 diff --git a/LibreOJ/2593/data/tortoise7.ans b/LibreOJ/2593/data/tortoise7.ans new file mode 100644 index 00000000..e05f6ad0 --- /dev/null +++ b/LibreOJ/2593/data/tortoise7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:098a81f35f116a0d13eec09bbb308535126fc9f92e439c24154bb95da32a660f +size 5 diff --git a/LibreOJ/2593/data/tortoise7.in b/LibreOJ/2593/data/tortoise7.in new file mode 100644 index 00000000..bed1d9f1 --- /dev/null +++ b/LibreOJ/2593/data/tortoise7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d2965d1b4c58f48598896f1e0c4653e15bb180cf45d53ee9b47ace1bec73d13 +size 947 diff --git a/LibreOJ/2593/data/tortoise8.ans b/LibreOJ/2593/data/tortoise8.ans new file mode 100644 index 00000000..6cef2868 --- /dev/null +++ b/LibreOJ/2593/data/tortoise8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34a3e95a660fcd0e02bf5818da3f55b83fd91ff5286f0e16c1256b0b3c72bbeb +size 5 diff --git a/LibreOJ/2593/data/tortoise8.in b/LibreOJ/2593/data/tortoise8.in new file mode 100644 index 00000000..b2c4e815 --- /dev/null +++ b/LibreOJ/2593/data/tortoise8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b7f14964ce8aa872226dca95ef98aff6146262efb29cb39fbcf7294f15732994 +size 1171 diff --git a/LibreOJ/2593/data/tortoise9.ans b/LibreOJ/2593/data/tortoise9.ans new file mode 100644 index 00000000..235ce9ee --- /dev/null +++ b/LibreOJ/2593/data/tortoise9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4822c7d041b94a0c2ffb77ad9b76fb17412b3d69e52deab2a0b6587904fadb08 +size 5 diff --git a/LibreOJ/2593/data/tortoise9.in b/LibreOJ/2593/data/tortoise9.in new file mode 100644 index 00000000..53bc6674 --- /dev/null +++ b/LibreOJ/2593/data/tortoise9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eec4c7a536aca6e091fd43db8dcfb2b85c8657cf2bfd5b3a5c2f0d8e6fc0025d +size 1108