From 838adadd015883f66a8c4afa8dc8efeece92965f Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 24 Aug 2022 11:06:16 +0800 Subject: [PATCH] =?UTF-8?q?#1495.=20=E7=AC=A6=E6=96=87=E5=B8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/55332 --- S2OJ/1495/1495.cpp | 35 +++++++++++++++++++++++++++++++++++ S2OJ/1495/data/data1.in | 3 +++ S2OJ/1495/data/data1.out | 3 +++ S2OJ/1495/data/data10.in | 3 +++ S2OJ/1495/data/data10.out | 3 +++ S2OJ/1495/data/data2.in | 3 +++ S2OJ/1495/data/data2.out | 3 +++ S2OJ/1495/data/data3.in | 3 +++ S2OJ/1495/data/data3.out | 3 +++ S2OJ/1495/data/data4.in | 3 +++ S2OJ/1495/data/data4.out | 3 +++ S2OJ/1495/data/data5.in | 3 +++ S2OJ/1495/data/data5.out | 3 +++ S2OJ/1495/data/data6.in | 3 +++ S2OJ/1495/data/data6.out | 3 +++ S2OJ/1495/data/data7.in | 3 +++ S2OJ/1495/data/data7.out | 3 +++ S2OJ/1495/data/data8.in | 3 +++ S2OJ/1495/data/data8.out | 3 +++ S2OJ/1495/data/data9.in | 3 +++ S2OJ/1495/data/data9.out | 3 +++ S2OJ/1495/data/problem.conf | 3 +++ 22 files changed, 98 insertions(+) create mode 100644 S2OJ/1495/1495.cpp create mode 100644 S2OJ/1495/data/data1.in create mode 100644 S2OJ/1495/data/data1.out create mode 100644 S2OJ/1495/data/data10.in create mode 100644 S2OJ/1495/data/data10.out create mode 100644 S2OJ/1495/data/data2.in create mode 100644 S2OJ/1495/data/data2.out create mode 100644 S2OJ/1495/data/data3.in create mode 100644 S2OJ/1495/data/data3.out create mode 100644 S2OJ/1495/data/data4.in create mode 100644 S2OJ/1495/data/data4.out create mode 100644 S2OJ/1495/data/data5.in create mode 100644 S2OJ/1495/data/data5.out create mode 100644 S2OJ/1495/data/data6.in create mode 100644 S2OJ/1495/data/data6.out create mode 100644 S2OJ/1495/data/data7.in create mode 100644 S2OJ/1495/data/data7.out create mode 100644 S2OJ/1495/data/data8.in create mode 100644 S2OJ/1495/data/data8.out create mode 100644 S2OJ/1495/data/data9.in create mode 100644 S2OJ/1495/data/data9.out create mode 100644 S2OJ/1495/data/problem.conf diff --git a/S2OJ/1495/1495.cpp b/S2OJ/1495/1495.cpp new file mode 100644 index 00000000..561936f7 --- /dev/null +++ b/S2OJ/1495/1495.cpp @@ -0,0 +1,35 @@ +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1005; + +int n, v[N], w[N], f[N], ans; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + for (int i = 1; i <= n; i++) { + cin >> v[i]; + } + + for (int i = 1; i <= n; i++) { + cin >> w[i]; + } + + for (int i = 1; i <= n; i++) { + for (int j = n; j >= v[i]; j--) { + f[j] = std::max(f[j], f[j - v[i]] + w[i]); + ans = std::max(ans, f[j]); + } + } + + cout << ans << endl; + + return 0; +} diff --git a/S2OJ/1495/data/data1.in b/S2OJ/1495/data/data1.in new file mode 100644 index 00000000..374b4166 --- /dev/null +++ b/S2OJ/1495/data/data1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:49d5be8323854b14d31f8f9428bc18b19e7f8f81c659ec98789f59e57795545d +size 95 diff --git a/S2OJ/1495/data/data1.out b/S2OJ/1495/data/data1.out new file mode 100644 index 00000000..1cf81171 --- /dev/null +++ b/S2OJ/1495/data/data1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:260c69a7593894ad3023b24287dffb4f9b0c5befcfb233a827ea00c17fc3c62c +size 8 diff --git a/S2OJ/1495/data/data10.in b/S2OJ/1495/data/data10.in new file mode 100644 index 00000000..10b7a0ee --- /dev/null +++ b/S2OJ/1495/data/data10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f278d504d227a7c4510503175822ea5a59e050b9c58018e92e1ee4ae9028614 +size 9673 diff --git a/S2OJ/1495/data/data10.out b/S2OJ/1495/data/data10.out new file mode 100644 index 00000000..48657b90 --- /dev/null +++ b/S2OJ/1495/data/data10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3845c2c311e14ae332d34b7abbc12a5c3cc6077978fca60b658af8cfab9caf1 +size 10 diff --git a/S2OJ/1495/data/data2.in b/S2OJ/1495/data/data2.in new file mode 100644 index 00000000..05ddcae5 --- /dev/null +++ b/S2OJ/1495/data/data2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14358b328d5c3d4659e3c288a7e608ee85394d2f86ad512c244a778f69dbb33a +size 9670 diff --git a/S2OJ/1495/data/data2.out b/S2OJ/1495/data/data2.out new file mode 100644 index 00000000..0d0cbc5b --- /dev/null +++ b/S2OJ/1495/data/data2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09126bd29dbb203f84a333bfff20c31a85caa45b003e6b4c52fa360871f07cea +size 10 diff --git a/S2OJ/1495/data/data3.in b/S2OJ/1495/data/data3.in new file mode 100644 index 00000000..9f354798 --- /dev/null +++ b/S2OJ/1495/data/data3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:de18ae666496bab8c9f051affef7290a36bfca41ada4341bd6d5ab71e1b6c648 +size 9679 diff --git a/S2OJ/1495/data/data3.out b/S2OJ/1495/data/data3.out new file mode 100644 index 00000000..e1a0ed31 --- /dev/null +++ b/S2OJ/1495/data/data3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1eccabd9dc28a87f7a2ee60c71359549b2aca9ee76a52f741614bcc632b86f89 +size 10 diff --git a/S2OJ/1495/data/data4.in b/S2OJ/1495/data/data4.in new file mode 100644 index 00000000..c7fd04bb --- /dev/null +++ b/S2OJ/1495/data/data4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fbcfb29e7939c2680ee56bc1934b9bb5371454cb9521524dada9ba285b0f214f +size 95 diff --git a/S2OJ/1495/data/data4.out b/S2OJ/1495/data/data4.out new file mode 100644 index 00000000..7afb7b18 --- /dev/null +++ b/S2OJ/1495/data/data4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ccb0c791fa5dbbf970e3c8fceb30084c0b85f9f4b5324d6e5418363c3c002ab +size 8 diff --git a/S2OJ/1495/data/data5.in b/S2OJ/1495/data/data5.in new file mode 100644 index 00000000..f0402bc2 --- /dev/null +++ b/S2OJ/1495/data/data5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e73af589dba9c3b32d3b3363b65e188c8267c92d865578148cc810eb74f33727 +size 93 diff --git a/S2OJ/1495/data/data5.out b/S2OJ/1495/data/data5.out new file mode 100644 index 00000000..135b414d --- /dev/null +++ b/S2OJ/1495/data/data5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ca8c0aa598660bd8878daf5a3577824f63ea78a58526fcc05d6a0812ca17c9f +size 8 diff --git a/S2OJ/1495/data/data6.in b/S2OJ/1495/data/data6.in new file mode 100644 index 00000000..2c2b8bbe --- /dev/null +++ b/S2OJ/1495/data/data6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bff0cb2ad9a7f0e31718e05ceeb08c236fee8cca22e80a5f2e90ca1317a31882 +size 184 diff --git a/S2OJ/1495/data/data6.out b/S2OJ/1495/data/data6.out new file mode 100644 index 00000000..0ec6b67d --- /dev/null +++ b/S2OJ/1495/data/data6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:05ce2628d24a1eaeda88a5bca2577151fd70590cc9d1c31165e930383e0d2aac +size 8 diff --git a/S2OJ/1495/data/data7.in b/S2OJ/1495/data/data7.in new file mode 100644 index 00000000..244d5d38 --- /dev/null +++ b/S2OJ/1495/data/data7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b7172dc84374dae339453235eec85684d5e4861547f043c34b269f149337d5e +size 182 diff --git a/S2OJ/1495/data/data7.out b/S2OJ/1495/data/data7.out new file mode 100644 index 00000000..934927c0 --- /dev/null +++ b/S2OJ/1495/data/data7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9cb7bfe85f404c245f4d2b1f030e669f10820c71d5e0acf16ab35e867b04916a +size 8 diff --git a/S2OJ/1495/data/data8.in b/S2OJ/1495/data/data8.in new file mode 100644 index 00000000..2c3f8df9 --- /dev/null +++ b/S2OJ/1495/data/data8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d15bb2205eadf2ec167477a34f01e8b98a830d9621e9377b06a408152b9503a4 +size 937 diff --git a/S2OJ/1495/data/data8.out b/S2OJ/1495/data/data8.out new file mode 100644 index 00000000..144a0f4b --- /dev/null +++ b/S2OJ/1495/data/data8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:afd751db719d14c8bbd509236627fb7b0be66d5430ae2fb2898ab08209bbf889 +size 9 diff --git a/S2OJ/1495/data/data9.in b/S2OJ/1495/data/data9.in new file mode 100644 index 00000000..dc24189f --- /dev/null +++ b/S2OJ/1495/data/data9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed2996b5f7ab85ecd5df20b1789751c797b6ac1bf4290818d7721207328f150b +size 949 diff --git a/S2OJ/1495/data/data9.out b/S2OJ/1495/data/data9.out new file mode 100644 index 00000000..939a6e0e --- /dev/null +++ b/S2OJ/1495/data/data9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71a27c2b86fb9b5084b49b26c802cbef929d390b53331ea93a619167019f6683 +size 9 diff --git a/S2OJ/1495/data/problem.conf b/S2OJ/1495/data/problem.conf new file mode 100644 index 00000000..4123f747 --- /dev/null +++ b/S2OJ/1495/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea854f4e7fc39bb22aeb2188ace2efdd3dee3e986edbcd7e2d0d7404b9941574 +size 177