From 28a06a7aca7dde5995e53cef5c0c54de6cc1183b Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 14 Nov 2022 11:28:09 +0800 Subject: [PATCH] =?UTF-8?q?#758.=20=E3=80=90SCOI2008=E3=80=91=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/64246 --- S2OJ/758/758.cpp | 45 ++++++++++++++++++++++++++++++++++++++ S2OJ/758/data/data1.in | 3 +++ S2OJ/758/data/data1.out | 3 +++ S2OJ/758/data/data10.in | 3 +++ S2OJ/758/data/data10.out | 3 +++ S2OJ/758/data/data2.in | 3 +++ S2OJ/758/data/data2.out | 3 +++ S2OJ/758/data/data3.in | 3 +++ S2OJ/758/data/data3.out | 3 +++ S2OJ/758/data/data4.in | 3 +++ S2OJ/758/data/data4.out | 3 +++ S2OJ/758/data/data5.in | 3 +++ S2OJ/758/data/data5.out | 3 +++ S2OJ/758/data/data6.in | 3 +++ S2OJ/758/data/data6.out | 3 +++ S2OJ/758/data/data7.in | 3 +++ S2OJ/758/data/data7.out | 3 +++ S2OJ/758/data/data8.in | 3 +++ S2OJ/758/data/data8.out | 3 +++ S2OJ/758/data/data9.in | 3 +++ S2OJ/758/data/data9.out | 3 +++ S2OJ/758/data/problem.conf | 3 +++ 22 files changed, 108 insertions(+) create mode 100644 S2OJ/758/758.cpp create mode 100644 S2OJ/758/data/data1.in create mode 100644 S2OJ/758/data/data1.out create mode 100644 S2OJ/758/data/data10.in create mode 100644 S2OJ/758/data/data10.out create mode 100644 S2OJ/758/data/data2.in create mode 100644 S2OJ/758/data/data2.out create mode 100644 S2OJ/758/data/data3.in create mode 100644 S2OJ/758/data/data3.out create mode 100644 S2OJ/758/data/data4.in create mode 100644 S2OJ/758/data/data4.out create mode 100644 S2OJ/758/data/data5.in create mode 100644 S2OJ/758/data/data5.out create mode 100644 S2OJ/758/data/data6.in create mode 100644 S2OJ/758/data/data6.out create mode 100644 S2OJ/758/data/data7.in create mode 100644 S2OJ/758/data/data7.out create mode 100644 S2OJ/758/data/data8.in create mode 100644 S2OJ/758/data/data8.out create mode 100644 S2OJ/758/data/data9.in create mode 100644 S2OJ/758/data/data9.out create mode 100644 S2OJ/758/data/problem.conf diff --git a/S2OJ/758/758.cpp b/S2OJ/758/758.cpp new file mode 100644 index 00000000..daae2d14 --- /dev/null +++ b/S2OJ/758/758.cpp @@ -0,0 +1,45 @@ +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 15 + 2, + K = 105; + +int k, n, p[N], s[N]; +double f[K][1 << N]; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> k >> n; + + for (int i = 1, x; i <= n; i++) { + cin >> p[i]; + + while (cin >> x, x) { + s[i] |= 1 << x - 1; + } + } + + for (int i = k; i; i--) { + for (int t = 0; t < 1 << n; t++) { + for (int j = 1; j <= n; j++) { + if ((t & s[j]) == s[j]) { + f[i][t] += std::max(f[i + 1][t], f[i + 1][t | (1 << j - 1)] + p[j]); + } else { + f[i][t] += f[i + 1][t]; + } + } + + f[i][t] /= n; + } + } + + cout << std::fixed << std::setprecision(6) << f[1][0] << endl; + + return 0; +} diff --git a/S2OJ/758/data/data1.in b/S2OJ/758/data/data1.in new file mode 100644 index 00000000..4f921680 --- /dev/null +++ b/S2OJ/758/data/data1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8f73df8e101a329c5f389bd6a84f5523410adedefb848565add400cbf1a9049 +size 231 diff --git a/S2OJ/758/data/data1.out b/S2OJ/758/data/data1.out new file mode 100644 index 00000000..026d8adb --- /dev/null +++ b/S2OJ/758/data/data1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e27ed1fbfe38b188d838abea0789d68fe6ec2a54bc9310157726109e13bd3cc +size 15 diff --git a/S2OJ/758/data/data10.in b/S2OJ/758/data/data10.in new file mode 100644 index 00000000..305adeae --- /dev/null +++ b/S2OJ/758/data/data10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad51faafe1b16e125f6c3823690c7c24655119a7fa28b935a561c180431a8615 +size 139 diff --git a/S2OJ/758/data/data10.out b/S2OJ/758/data/data10.out new file mode 100644 index 00000000..27c3871c --- /dev/null +++ b/S2OJ/758/data/data10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:070e9721f90575e3e5b627f34797ec0ee2b03ae987ad71fe1eb58f139a537f5e +size 12 diff --git a/S2OJ/758/data/data2.in b/S2OJ/758/data/data2.in new file mode 100644 index 00000000..0c3df3da --- /dev/null +++ b/S2OJ/758/data/data2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eee7a0182ac0c13c05e157a28d96031e415ad21139651405f98f80ae5c6af543 +size 227 diff --git a/S2OJ/758/data/data2.out b/S2OJ/758/data/data2.out new file mode 100644 index 00000000..3f4fc0f8 --- /dev/null +++ b/S2OJ/758/data/data2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:148e33b37b7ab26d9bce133fff63f493d7b9ae43b99b56f5899122762e4a04d1 +size 14 diff --git a/S2OJ/758/data/data3.in b/S2OJ/758/data/data3.in new file mode 100644 index 00000000..e755ee35 --- /dev/null +++ b/S2OJ/758/data/data3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4249d567b85ef7ef942b20b7c929149c3a950acd7cfb33e019a8ec276835c5f3 +size 71 diff --git a/S2OJ/758/data/data3.out b/S2OJ/758/data/data3.out new file mode 100644 index 00000000..315afeb6 --- /dev/null +++ b/S2OJ/758/data/data3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:727798bae4c28ff550b4ccee6f64581ac566c317117ff0e9b78b27e1f7fb20c9 +size 11 diff --git a/S2OJ/758/data/data4.in b/S2OJ/758/data/data4.in new file mode 100644 index 00000000..0879e268 --- /dev/null +++ b/S2OJ/758/data/data4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b567e341b854a55be397710a65d43ab6ea5da0681fdf061e6387d6014e113428 +size 33 diff --git a/S2OJ/758/data/data4.out b/S2OJ/758/data/data4.out new file mode 100644 index 00000000..8fb8ff15 --- /dev/null +++ b/S2OJ/758/data/data4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79703f3872dff14e19d11a65e2b9bb974fa809d81525d85ef6eb1120d533bc55 +size 9 diff --git a/S2OJ/758/data/data5.in b/S2OJ/758/data/data5.in new file mode 100644 index 00000000..096878f6 --- /dev/null +++ b/S2OJ/758/data/data5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c37fdadb32f1508c0d4cab231e99b0492ac08caccd2ba4ac8c3dcce5637a74f +size 82 diff --git a/S2OJ/758/data/data5.out b/S2OJ/758/data/data5.out new file mode 100644 index 00000000..57f08d29 --- /dev/null +++ b/S2OJ/758/data/data5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b85b7925c208792b59452c385e1d9b8fdbd8eef1aaf8e56d6c2fb193de0d36f +size 9 diff --git a/S2OJ/758/data/data6.in b/S2OJ/758/data/data6.in new file mode 100644 index 00000000..0ae10e0c --- /dev/null +++ b/S2OJ/758/data/data6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2fdadcc704bb26853e91dc959898ed023cf6a7c350203a9aeb24b990cf4191e7 +size 16 diff --git a/S2OJ/758/data/data6.out b/S2OJ/758/data/data6.out new file mode 100644 index 00000000..1b48117d --- /dev/null +++ b/S2OJ/758/data/data6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65e8fe344f770e52ea7f3f8fc8633959361bb78e6ad3a178b7d3b1f16b6e2e9f +size 9 diff --git a/S2OJ/758/data/data7.in b/S2OJ/758/data/data7.in new file mode 100644 index 00000000..a51d05bf --- /dev/null +++ b/S2OJ/758/data/data7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b3812b5edf4b4472e06607124a57f6dfee5297813ce9cb43eb4498e66c18ab9 +size 64 diff --git a/S2OJ/758/data/data7.out b/S2OJ/758/data/data7.out new file mode 100644 index 00000000..69ffe68e --- /dev/null +++ b/S2OJ/758/data/data7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c191b6cd7d0603a22fdaa194e904e0c671df80c0daaf4554cf3df998cc96c7c4 +size 9 diff --git a/S2OJ/758/data/data8.in b/S2OJ/758/data/data8.in new file mode 100644 index 00000000..d04bfbc0 --- /dev/null +++ b/S2OJ/758/data/data8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d36c0d1f74e42db89f90f45c6977f175b04d14476fcc6468ab816c7499f897f8 +size 225 diff --git a/S2OJ/758/data/data8.out b/S2OJ/758/data/data8.out new file mode 100644 index 00000000..156a8530 --- /dev/null +++ b/S2OJ/758/data/data8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3315fcb9b8c4438af532112350359940c62a28136a9668529b28bc442d23c979 +size 14 diff --git a/S2OJ/758/data/data9.in b/S2OJ/758/data/data9.in new file mode 100644 index 00000000..b0ba50e7 --- /dev/null +++ b/S2OJ/758/data/data9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12026a5ff050f9ac7f7e3fa525b86733f02546114d673c28c64ac4541ad8a790 +size 22 diff --git a/S2OJ/758/data/data9.out b/S2OJ/758/data/data9.out new file mode 100644 index 00000000..93eb602e --- /dev/null +++ b/S2OJ/758/data/data9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:338dc188788f9f15aa9ed4df2ddadec8f39ae89f4717108d7d6b6ca27546261b +size 9 diff --git a/S2OJ/758/data/problem.conf b/S2OJ/758/data/problem.conf new file mode 100644 index 00000000..5167c29b --- /dev/null +++ b/S2OJ/758/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bca1ef95e6b2f9a5528c259d80b990b58662ae5c15d2e81c7ff17e5a1f18ebd +size 193