From fdc6cacd6833adb78bfd5fa2fba51589f351e683 Mon Sep 17 00:00:00 2001 From: Baoshuo Ren Date: Thu, 2 Dec 2021 20:44:36 +0800 Subject: [PATCH] =?UTF-8?q?P2672=20[NOIP2015=20=E6=99=AE=E5=8F=8A=E7=BB=84?= =?UTF-8?q?]=20=E6=8E=A8=E9=94=80=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R64117019 --- Luogu/P2672/P2672.cpp | 40 +++++++++++++++++++++++++++++++++ Luogu/P2672/data/salesman1.ans | 3 +++ Luogu/P2672/data/salesman1.in | 3 +++ Luogu/P2672/data/salesman10.ans | 3 +++ Luogu/P2672/data/salesman10.in | 3 +++ Luogu/P2672/data/salesman2.ans | 3 +++ Luogu/P2672/data/salesman2.in | 3 +++ Luogu/P2672/data/salesman3.ans | 3 +++ Luogu/P2672/data/salesman3.in | 3 +++ Luogu/P2672/data/salesman4.ans | 3 +++ Luogu/P2672/data/salesman4.in | 3 +++ Luogu/P2672/data/salesman5.ans | 3 +++ Luogu/P2672/data/salesman5.in | 3 +++ Luogu/P2672/data/salesman6.ans | 3 +++ Luogu/P2672/data/salesman6.in | 3 +++ Luogu/P2672/data/salesman7.ans | 3 +++ Luogu/P2672/data/salesman7.in | 3 +++ Luogu/P2672/data/salesman8.ans | 3 +++ Luogu/P2672/data/salesman8.in | 3 +++ Luogu/P2672/data/salesman9.ans | 3 +++ Luogu/P2672/data/salesman9.in | 3 +++ 21 files changed, 100 insertions(+) create mode 100644 Luogu/P2672/P2672.cpp create mode 100644 Luogu/P2672/data/salesman1.ans create mode 100644 Luogu/P2672/data/salesman1.in create mode 100644 Luogu/P2672/data/salesman10.ans create mode 100644 Luogu/P2672/data/salesman10.in create mode 100644 Luogu/P2672/data/salesman2.ans create mode 100644 Luogu/P2672/data/salesman2.in create mode 100644 Luogu/P2672/data/salesman3.ans create mode 100644 Luogu/P2672/data/salesman3.in create mode 100644 Luogu/P2672/data/salesman4.ans create mode 100644 Luogu/P2672/data/salesman4.in create mode 100644 Luogu/P2672/data/salesman5.ans create mode 100644 Luogu/P2672/data/salesman5.in create mode 100644 Luogu/P2672/data/salesman6.ans create mode 100644 Luogu/P2672/data/salesman6.in create mode 100644 Luogu/P2672/data/salesman7.ans create mode 100644 Luogu/P2672/data/salesman7.in create mode 100644 Luogu/P2672/data/salesman8.ans create mode 100644 Luogu/P2672/data/salesman8.in create mode 100644 Luogu/P2672/data/salesman9.ans create mode 100644 Luogu/P2672/data/salesman9.in diff --git a/Luogu/P2672/P2672.cpp b/Luogu/P2672/P2672.cpp new file mode 100644 index 00000000..237e1eac --- /dev/null +++ b/Luogu/P2672/P2672.cpp @@ -0,0 +1,40 @@ +#include + +using std::cin; +using std::cout; +using std::endl; + +int n, now; +long long ans; +std::pair a[100005]; +std::priority_queue q; + +int main() { + cin >> n; + for (int i = 1; i <= n; i++) { + cin >> a[i].first; + } + for (int i = 1; i <= n; i++) { + cin >> a[i].second; + } + q.push(0); + for (int i = 1; i <= n; i++) { + int max = q.top(); + int maxn = now; + for (int j = now + 1; j <= n; j++) { + if ((a[j].first - a[now].first) * 2 + a[j].second >= max) { + max = (a[j].first - a[now].first) * 2 + a[j].second; + maxn = j; + } + } + if (maxn != now) q.push(max); + for (int j = now + 1; j < maxn; j++) { + q.push(a[j].second); + } + now = maxn; + ans += q.top(); + q.pop(); + cout << ans << endl; + } + return 0; +} diff --git a/Luogu/P2672/data/salesman1.ans b/Luogu/P2672/data/salesman1.ans new file mode 100644 index 00000000..d76b1b82 --- /dev/null +++ b/Luogu/P2672/data/salesman1.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:79206a6dc6d28d7b901d33d753a135bdc17a64461031b01567ce3331d9af3611 +size 114 diff --git a/Luogu/P2672/data/salesman1.in b/Luogu/P2672/data/salesman1.in new file mode 100644 index 00000000..8a22b159 --- /dev/null +++ b/Luogu/P2672/data/salesman1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a4ba0055de5a48988884e66dd43a1f709cf124b2995e4efd47fc6bcbbc2f777 +size 166 diff --git a/Luogu/P2672/data/salesman10.ans b/Luogu/P2672/data/salesman10.ans new file mode 100644 index 00000000..68ef8661 --- /dev/null +++ b/Luogu/P2672/data/salesman10.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d20124aea49748b6fab4ebacde77134b224897a77b278bd6a4fa5f93ee2768fc +size 883194 diff --git a/Luogu/P2672/data/salesman10.in b/Luogu/P2672/data/salesman10.in new file mode 100644 index 00000000..b79160c9 --- /dev/null +++ b/Luogu/P2672/data/salesman10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e445d4e112e9a5e5fc1bac42d319bc4a10ed058d1dfaae1aa3eb476b4a824a0 +size 949980 diff --git a/Luogu/P2672/data/salesman2.ans b/Luogu/P2672/data/salesman2.ans new file mode 100644 index 00000000..501e7e91 --- /dev/null +++ b/Luogu/P2672/data/salesman2.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08f7add5a283ab2806d6f879c369bd3d52165ef0ebe82b34c7feebfa03ead593 +size 108 diff --git a/Luogu/P2672/data/salesman2.in b/Luogu/P2672/data/salesman2.in new file mode 100644 index 00000000..6fb556c2 --- /dev/null +++ b/Luogu/P2672/data/salesman2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c54875c02e09daf06342648b79c20ae623cf2eba7e2e5c2f38ee3cdce0fee0f +size 159 diff --git a/Luogu/P2672/data/salesman3.ans b/Luogu/P2672/data/salesman3.ans new file mode 100644 index 00000000..82df14b8 --- /dev/null +++ b/Luogu/P2672/data/salesman3.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44de99c8b9a4a7f62cea00b921d9c9f161e963438455ded8f4459f60901301e9 +size 666 diff --git a/Luogu/P2672/data/salesman3.in b/Luogu/P2672/data/salesman3.in new file mode 100644 index 00000000..2da484de --- /dev/null +++ b/Luogu/P2672/data/salesman3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a293563be839a2e60436b4eb4b9999d7b901a911f022d2dff2871bc4c25efe48 +size 923 diff --git a/Luogu/P2672/data/salesman4.ans b/Luogu/P2672/data/salesman4.ans new file mode 100644 index 00000000..966f8177 --- /dev/null +++ b/Luogu/P2672/data/salesman4.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b6cbbdc33ec248d6b86dfd455a32bf20c9d6d8eb3cdbf04505939387502bc58 +size 679 diff --git a/Luogu/P2672/data/salesman4.in b/Luogu/P2672/data/salesman4.in new file mode 100644 index 00000000..979d0744 --- /dev/null +++ b/Luogu/P2672/data/salesman4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:345f6e2584025a924e84860243027e5de0031f5893d6580c47a6f0d9e633258a +size 934 diff --git a/Luogu/P2672/data/salesman5.ans b/Luogu/P2672/data/salesman5.ans new file mode 100644 index 00000000..5366919c --- /dev/null +++ b/Luogu/P2672/data/salesman5.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff3ea9337b90465d3f2c57ac3611a0f82624286efb1bd4748d3ae567c0691e0e +size 7945 diff --git a/Luogu/P2672/data/salesman5.in b/Luogu/P2672/data/salesman5.in new file mode 100644 index 00000000..291947ec --- /dev/null +++ b/Luogu/P2672/data/salesman5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e7b7b34e1ccf8093e5c2a1de25bd7e4f109569e316e31ddcdb8d7b17180386d8 +size 10614 diff --git a/Luogu/P2672/data/salesman6.ans b/Luogu/P2672/data/salesman6.ans new file mode 100644 index 00000000..4c13d712 --- /dev/null +++ b/Luogu/P2672/data/salesman6.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:48f45bdf8ed74f3895cd40f01b287f3c8cbe2158b9eb742b89c90789f88d84e2 +size 7939 diff --git a/Luogu/P2672/data/salesman6.in b/Luogu/P2672/data/salesman6.in new file mode 100644 index 00000000..808b5d5c --- /dev/null +++ b/Luogu/P2672/data/salesman6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3fcd14be22305a9c3b31738028d6865c6c3fcf91cff4a06cf37b58beaf12549a +size 10624 diff --git a/Luogu/P2672/data/salesman7.ans b/Luogu/P2672/data/salesman7.ans new file mode 100644 index 00000000..bd5a3935 --- /dev/null +++ b/Luogu/P2672/data/salesman7.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1929e430a95663e43be78ab6ef64fb87b4e77983dac501e630ab80ab28ff8e67 +size 989315 diff --git a/Luogu/P2672/data/salesman7.in b/Luogu/P2672/data/salesman7.in new file mode 100644 index 00000000..14781e69 --- /dev/null +++ b/Luogu/P2672/data/salesman7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5621d2e7025ecd7ec676064330e665eb63985b2601b2ae8eb8bccf38286548d5 +size 1083932 diff --git a/Luogu/P2672/data/salesman8.ans b/Luogu/P2672/data/salesman8.ans new file mode 100644 index 00000000..4331cc20 --- /dev/null +++ b/Luogu/P2672/data/salesman8.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9973fbda3e4226ea339bacdf3998140e898feee7d859f1c0a7586988d8084fa +size 991664 diff --git a/Luogu/P2672/data/salesman8.in b/Luogu/P2672/data/salesman8.in new file mode 100644 index 00000000..aaaecad3 --- /dev/null +++ b/Luogu/P2672/data/salesman8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:10d8cf6f540cae6b9425717e792db76317bcfca2f87771b2cdc575669996bdc5 +size 1086093 diff --git a/Luogu/P2672/data/salesman9.ans b/Luogu/P2672/data/salesman9.ans new file mode 100644 index 00000000..db0d4fe6 --- /dev/null +++ b/Luogu/P2672/data/salesman9.ans @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb2c0a6453b199c7a3477f4cda4a350da0bd0ac83ffb618da1a400e4349fd39e +size 875647 diff --git a/Luogu/P2672/data/salesman9.in b/Luogu/P2672/data/salesman9.in new file mode 100644 index 00000000..4c904d52 --- /dev/null +++ b/Luogu/P2672/data/salesman9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:df19eb5312c7638cf5122904f15827953ee250074e4700919b0b4d98f3838f32 +size 943163