From 273f8ac7ff0dd4274851c6a9578b74ebee7ca1ac Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 15 Sep 2022 17:29:47 +0800 Subject: [PATCH] =?UTF-8?q?2460.=20[BeiJing2011]=20=E5=85=83=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://hydro.ac/d/bzoj/record/6322f07e32ae6c3198cca121 --- BZOJ/2460/2460.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++ BZOJ/2460/data/1.in | 3 +++ BZOJ/2460/data/1.out | 3 +++ BZOJ/2460/data/10.in | 3 +++ BZOJ/2460/data/10.out | 3 +++ BZOJ/2460/data/2.in | 3 +++ BZOJ/2460/data/2.out | 3 +++ BZOJ/2460/data/3.in | 3 +++ BZOJ/2460/data/3.out | 3 +++ BZOJ/2460/data/4.in | 3 +++ BZOJ/2460/data/4.out | 3 +++ BZOJ/2460/data/5.in | 3 +++ BZOJ/2460/data/5.out | 3 +++ BZOJ/2460/data/6.in | 3 +++ BZOJ/2460/data/6.out | 3 +++ BZOJ/2460/data/7.in | 3 +++ BZOJ/2460/data/7.out | 3 +++ BZOJ/2460/data/8.in | 3 +++ BZOJ/2460/data/8.out | 3 +++ BZOJ/2460/data/9.in | 3 +++ BZOJ/2460/data/9.out | 3 +++ 21 files changed, 112 insertions(+) create mode 100644 BZOJ/2460/2460.cpp create mode 100644 BZOJ/2460/data/1.in create mode 100644 BZOJ/2460/data/1.out create mode 100644 BZOJ/2460/data/10.in create mode 100644 BZOJ/2460/data/10.out create mode 100644 BZOJ/2460/data/2.in create mode 100644 BZOJ/2460/data/2.out create mode 100644 BZOJ/2460/data/3.in create mode 100644 BZOJ/2460/data/3.out create mode 100644 BZOJ/2460/data/4.in create mode 100644 BZOJ/2460/data/4.out create mode 100644 BZOJ/2460/data/5.in create mode 100644 BZOJ/2460/data/5.out create mode 100644 BZOJ/2460/data/6.in create mode 100644 BZOJ/2460/data/6.out create mode 100644 BZOJ/2460/data/7.in create mode 100644 BZOJ/2460/data/7.out create mode 100644 BZOJ/2460/data/8.in create mode 100644 BZOJ/2460/data/8.out create mode 100644 BZOJ/2460/data/9.in create mode 100644 BZOJ/2460/data/9.out diff --git a/BZOJ/2460/2460.cpp b/BZOJ/2460/2460.cpp new file mode 100644 index 00000000..12142781 --- /dev/null +++ b/BZOJ/2460/2460.cpp @@ -0,0 +1,52 @@ +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1005; + +int n, ans; +std::pair a[N]; +unsigned long long p[N]; + +inline bool insert(unsigned long long x) { + for (int i = 0; i <= 61; i++) { + if (x & (1ull << i)) { + if (p[i]) { + x ^= p[i]; + } else { + p[i] = x; + + return true; + } + } + } + + return false; +} + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + cin >> n; + + for (int i = 1; i <= n; i++) { + cin >> a[i].second >> a[i].first; + } + + std::sort(a + 1, a + 1 + n, std::greater>()); + + for (int i = 1; i <= n; i++) { + if (insert(a[i].second)) { + ans += a[i].first; + } + } + + cout << ans << endl; + + return 0; +} diff --git a/BZOJ/2460/data/1.in b/BZOJ/2460/data/1.in new file mode 100644 index 00000000..22715e4a --- /dev/null +++ b/BZOJ/2460/data/1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1ee2f995228efb52d0553c91d3a3b0b3a4332cf81522c3415d8e8693b214176 +size 83 diff --git a/BZOJ/2460/data/1.out b/BZOJ/2460/data/1.out new file mode 100644 index 00000000..69a76fe6 --- /dev/null +++ b/BZOJ/2460/data/1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75bff4f072a5e8be0e1c60f1834f025518b318408b409fbe3b69cc7b86121684 +size 6 diff --git a/BZOJ/2460/data/10.in b/BZOJ/2460/data/10.in new file mode 100644 index 00000000..f1c24f04 --- /dev/null +++ b/BZOJ/2460/data/10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b257745b7a3b8f164b2b009b9d511b2fbca11c40a49d5db5bae4279ee6da8d09 +size 36 diff --git a/BZOJ/2460/data/10.out b/BZOJ/2460/data/10.out new file mode 100644 index 00000000..e5b940cb --- /dev/null +++ b/BZOJ/2460/data/10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d083ddbeaf60d5039dab5b9a9f3ba47d9018019589d7d6d3172ff86d3b97a64 +size 4 diff --git a/BZOJ/2460/data/2.in b/BZOJ/2460/data/2.in new file mode 100644 index 00000000..1460bf3a --- /dev/null +++ b/BZOJ/2460/data/2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c36039c94a4b36a1954ee098307d1a5f90c678282f10613d80572cf335dfc72e +size 107 diff --git a/BZOJ/2460/data/2.out b/BZOJ/2460/data/2.out new file mode 100644 index 00000000..4187bcf1 --- /dev/null +++ b/BZOJ/2460/data/2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bdd9eb175e1092e80206ce7c587118ba066789764d5b5a312d55230cc46d785f +size 6 diff --git a/BZOJ/2460/data/3.in b/BZOJ/2460/data/3.in new file mode 100644 index 00000000..8a733e84 --- /dev/null +++ b/BZOJ/2460/data/3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a31bdf421a41f26f2d49127b2792bc2bd489f38326c3aca5709ec8b75bb586db +size 14287 diff --git a/BZOJ/2460/data/3.out b/BZOJ/2460/data/3.out new file mode 100644 index 00000000..4e6ec007 --- /dev/null +++ b/BZOJ/2460/data/3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:826fdb2d05f7c6078d66429066f1fee2082aff3479675058b4128aae833cee79 +size 7 diff --git a/BZOJ/2460/data/4.in b/BZOJ/2460/data/4.in new file mode 100644 index 00000000..de79a27a --- /dev/null +++ b/BZOJ/2460/data/4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2e6d7d951195658b517113b3d0499232d6d0880f6961180eafe217cc957331e +size 18398 diff --git a/BZOJ/2460/data/4.out b/BZOJ/2460/data/4.out new file mode 100644 index 00000000..f54e20b8 --- /dev/null +++ b/BZOJ/2460/data/4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b29ca8253e123cef0c0b1ab2a775acf1c5b3c46b560d990bad259ef2635a1b4 +size 7 diff --git a/BZOJ/2460/data/5.in b/BZOJ/2460/data/5.in new file mode 100644 index 00000000..4fb8d0fb --- /dev/null +++ b/BZOJ/2460/data/5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8cddeaf727dcc4ee70178550c1745dfcf32ee8f44b7179e6506204b53a4b1b91 +size 23783 diff --git a/BZOJ/2460/data/5.out b/BZOJ/2460/data/5.out new file mode 100644 index 00000000..1b6c4c74 --- /dev/null +++ b/BZOJ/2460/data/5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0420b39e4c80c07ba2e53f66a2415b8b720df1e4299d13787ed5479b1dc83d7e +size 7 diff --git a/BZOJ/2460/data/6.in b/BZOJ/2460/data/6.in new file mode 100644 index 00000000..37754b15 --- /dev/null +++ b/BZOJ/2460/data/6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6db4aae49c2dba3eedb659e494013571943f01e1f5c1a7a74ae1214ce454ff8 +size 10240 diff --git a/BZOJ/2460/data/6.out b/BZOJ/2460/data/6.out new file mode 100644 index 00000000..655fc800 --- /dev/null +++ b/BZOJ/2460/data/6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a47eae5e638f129cceeee69efc4805ed6de3d1378fc6638edc69445eb1b90027 +size 7 diff --git a/BZOJ/2460/data/7.in b/BZOJ/2460/data/7.in new file mode 100644 index 00000000..3f18c1a1 --- /dev/null +++ b/BZOJ/2460/data/7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:243172f52b07b3e4376b00b074353ff82701e0d1ebf693e6b3b4095828a1e6a2 +size 1019 diff --git a/BZOJ/2460/data/7.out b/BZOJ/2460/data/7.out new file mode 100644 index 00000000..4cda9b19 --- /dev/null +++ b/BZOJ/2460/data/7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b4e55c94ecc66ee01e81645118bac716f193bda05acc25c1047f130d7632531 +size 7 diff --git a/BZOJ/2460/data/8.in b/BZOJ/2460/data/8.in new file mode 100644 index 00000000..b2a973e0 --- /dev/null +++ b/BZOJ/2460/data/8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea833536785e511d9941660c2f1a159b04c98ca57766060ac74ce4366b99a4f7 +size 11790 diff --git a/BZOJ/2460/data/8.out b/BZOJ/2460/data/8.out new file mode 100644 index 00000000..b0faf82a --- /dev/null +++ b/BZOJ/2460/data/8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:764481dcd45548136f918b1d5c9b36de73aa193a024591f986baf97f5a46aed8 +size 7 diff --git a/BZOJ/2460/data/9.in b/BZOJ/2460/data/9.in new file mode 100644 index 00000000..f00f23d1 --- /dev/null +++ b/BZOJ/2460/data/9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7cac7cfc84257db0fff582d58cb4f273a0b17e9903f3f9d1a0bc8e0fc1e1de04 +size 18287 diff --git a/BZOJ/2460/data/9.out b/BZOJ/2460/data/9.out new file mode 100644 index 00000000..c385c707 --- /dev/null +++ b/BZOJ/2460/data/9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec0d3204f1d0034bfeed86f4cbc61037663b4fe434b02b493f02118a3e36fac6 +size 7