From b836ec30abd74d40896d878c5be49a2102a6050d Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Mon, 3 Oct 2022 16:57:45 +0800 Subject: [PATCH] =?UTF-8?q?#910.=20[2018.8=E9=95=BF=E9=83=A1=E9=9B=86?= =?UTF-8?q?=E8=AE=ADday1]=E9=83=BD=E5=B8=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://sjzezoj.com/submission/59281 --- S2OJ/910/910.cpp | 79 ++++++++++++++++++++++++++++++++++++++ S2OJ/910/data/city1.in | 3 ++ S2OJ/910/data/city1.out | 3 ++ S2OJ/910/data/city10.in | 3 ++ S2OJ/910/data/city10.out | 3 ++ S2OJ/910/data/city2.in | 3 ++ S2OJ/910/data/city2.out | 3 ++ S2OJ/910/data/city3.in | 3 ++ S2OJ/910/data/city3.out | 3 ++ S2OJ/910/data/city4.in | 3 ++ S2OJ/910/data/city4.out | 3 ++ S2OJ/910/data/city5.in | 3 ++ S2OJ/910/data/city5.out | 3 ++ S2OJ/910/data/city6.in | 3 ++ S2OJ/910/data/city6.out | 3 ++ S2OJ/910/data/city7.in | 3 ++ S2OJ/910/data/city7.out | 3 ++ S2OJ/910/data/city8.in | 3 ++ S2OJ/910/data/city8.out | 3 ++ S2OJ/910/data/city9.in | 3 ++ S2OJ/910/data/city9.out | 3 ++ S2OJ/910/data/ex_city1.in | 3 ++ S2OJ/910/data/ex_city1.out | 3 ++ S2OJ/910/data/ex_city2.in | 3 ++ S2OJ/910/data/ex_city2.out | 3 ++ S2OJ/910/data/problem.conf | 3 ++ 26 files changed, 154 insertions(+) create mode 100644 S2OJ/910/910.cpp create mode 100644 S2OJ/910/data/city1.in create mode 100644 S2OJ/910/data/city1.out create mode 100644 S2OJ/910/data/city10.in create mode 100644 S2OJ/910/data/city10.out create mode 100644 S2OJ/910/data/city2.in create mode 100644 S2OJ/910/data/city2.out create mode 100644 S2OJ/910/data/city3.in create mode 100644 S2OJ/910/data/city3.out create mode 100644 S2OJ/910/data/city4.in create mode 100644 S2OJ/910/data/city4.out create mode 100644 S2OJ/910/data/city5.in create mode 100644 S2OJ/910/data/city5.out create mode 100644 S2OJ/910/data/city6.in create mode 100644 S2OJ/910/data/city6.out create mode 100644 S2OJ/910/data/city7.in create mode 100644 S2OJ/910/data/city7.out create mode 100644 S2OJ/910/data/city8.in create mode 100644 S2OJ/910/data/city8.out create mode 100644 S2OJ/910/data/city9.in create mode 100644 S2OJ/910/data/city9.out create mode 100644 S2OJ/910/data/ex_city1.in create mode 100644 S2OJ/910/data/ex_city1.out create mode 100644 S2OJ/910/data/ex_city2.in create mode 100644 S2OJ/910/data/ex_city2.out create mode 100644 S2OJ/910/data/problem.conf diff --git a/S2OJ/910/910.cpp b/S2OJ/910/910.cpp new file mode 100644 index 00000000..90e57c35 --- /dev/null +++ b/S2OJ/910/910.cpp @@ -0,0 +1,79 @@ +#include +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + int n; + std::vector a; + std::vector> ans; + + cin >> n; + + for (int i = 1, x; i <= n * (n - 1) / 2; i++) { + cin >> x; + + a.emplace_back(x); + } + + std::sort(a.begin(), a.end()); + + for (int i = a[0] >> 1; i; i--) { + int b = a[0] - i, + c = a[1] - i; + + if (*std::lower_bound(a.begin(), a.end(), b + c) != b + c) continue; + + std::vector v; + std::unordered_map map; + + for (int x : a) map[x]++; + + v.emplace_back(i); + map[i + b]--; + v.emplace_back(b); + map[i + c]--; + v.emplace_back(c); + map[b + c]--; + + bool flag = false; + for (int j = 2; j < a.size() && !flag; j++) { + if (!map[a[j]]) continue; + + for (int x : v) { + if (!map.count(x + a[j] - i) || !map[x + a[j] - i]) { + flag = true; + + break; + } + + map[x + a[j] - i]--; + } + + v.emplace_back(a[j] - i); + } + + if (!flag) ans.emplace_back(v); + } + + cout << ans.size() << endl; + + std::sort(ans.begin(), ans.end(), std::greater<>()); + + for (auto item : ans) { + for (int x : item) { + cout << x << ' '; + } + + cout << endl; + } + + return 0; +} diff --git a/S2OJ/910/data/city1.in b/S2OJ/910/data/city1.in new file mode 100644 index 00000000..9292315e --- /dev/null +++ b/S2OJ/910/data/city1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c8592bbc12e68c5cffd13f303f29d6dcd3f5984e4dadc6fc6bd8f505e59a282 +size 25 diff --git a/S2OJ/910/data/city1.out b/S2OJ/910/data/city1.out new file mode 100644 index 00000000..ae88a431 --- /dev/null +++ b/S2OJ/910/data/city1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea2c990c376656e72810db1765aed28c28b767791e0eaa669fb99ee4e5abebc8 +size 12 diff --git a/S2OJ/910/data/city10.in b/S2OJ/910/data/city10.in new file mode 100644 index 00000000..f4716ba0 --- /dev/null +++ b/S2OJ/910/data/city10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7a989a21ad3dd44b3892bdc64905a3a97b70bb1bc98132772c73ec80fa716d1e +size 424640 diff --git a/S2OJ/910/data/city10.out b/S2OJ/910/data/city10.out new file mode 100644 index 00000000..292ef05b --- /dev/null +++ b/S2OJ/910/data/city10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcf73838cb631ce260b07ab68494fc74b8978e94e52b97b4c063edb6d971338b +size 2667 diff --git a/S2OJ/910/data/city2.in b/S2OJ/910/data/city2.in new file mode 100644 index 00000000..7c30cec3 --- /dev/null +++ b/S2OJ/910/data/city2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbedf82cfd8b262260ed2cd5a780ed77047405cd2d8f2d2cd48b8233d2f174c1 +size 32 diff --git a/S2OJ/910/data/city2.out b/S2OJ/910/data/city2.out new file mode 100644 index 00000000..4024aaec --- /dev/null +++ b/S2OJ/910/data/city2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a46e1d7beb69ee66dd4f8358676eaf92780806933292ed12ed6df9fa8cc08bf +size 13 diff --git a/S2OJ/910/data/city3.in b/S2OJ/910/data/city3.in new file mode 100644 index 00000000..37c2e227 --- /dev/null +++ b/S2OJ/910/data/city3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:652daa0a2656115bcffbcf88a1578bafc7d1104cf0b0c89c1cbad81ac8000dfd +size 32 diff --git a/S2OJ/910/data/city3.out b/S2OJ/910/data/city3.out new file mode 100644 index 00000000..0e3bcf62 --- /dev/null +++ b/S2OJ/910/data/city3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d4734be78a3fa6723212420520190affca2705f088856ad9fe602f52be5b1c5f +size 14 diff --git a/S2OJ/910/data/city4.in b/S2OJ/910/data/city4.in new file mode 100644 index 00000000..cdf18385 --- /dev/null +++ b/S2OJ/910/data/city4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56ed98d23c72aa013840575b599e70c383dfa1852829edeb942be87491017dee +size 4264 diff --git a/S2OJ/910/data/city4.out b/S2OJ/910/data/city4.out new file mode 100644 index 00000000..c87c6e17 --- /dev/null +++ b/S2OJ/910/data/city4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:971397fe23b82fff37217a2b04b598718c97023d56727f51e113dc79e4aa6d7c +size 146 diff --git a/S2OJ/910/data/city5.in b/S2OJ/910/data/city5.in new file mode 100644 index 00000000..992a7e70 --- /dev/null +++ b/S2OJ/910/data/city5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bcce3e75b6782b3755e5680409fdd3e9cd03f1151331d77b8ab32f1357548857 +size 4257 diff --git a/S2OJ/910/data/city5.out b/S2OJ/910/data/city5.out new file mode 100644 index 00000000..2357c7aa --- /dev/null +++ b/S2OJ/910/data/city5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:470e85c7a8102936aa24f14dd5b7209ec292f4bd06cbe2fa133ef25618f7c002 +size 149 diff --git a/S2OJ/910/data/city6.in b/S2OJ/910/data/city6.in new file mode 100644 index 00000000..8370176b --- /dev/null +++ b/S2OJ/910/data/city6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ee6729e74d6179dc9bb59d061d05cc601c9bef0b2ad31b2091628ea1c0ab0608 +size 4349 diff --git a/S2OJ/910/data/city6.out b/S2OJ/910/data/city6.out new file mode 100644 index 00000000..e05a8b42 --- /dev/null +++ b/S2OJ/910/data/city6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7f8fdd9f453e7abf966879b2d2a36a8e33ea6501285bb28b133f871d51172bff +size 148 diff --git a/S2OJ/910/data/city7.in b/S2OJ/910/data/city7.in new file mode 100644 index 00000000..d3915e18 --- /dev/null +++ b/S2OJ/910/data/city7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:592caa7492405c33e99bc785ee0ba77286214553cb33e07bd4a6c9765941a9d9 +size 425771 diff --git a/S2OJ/910/data/city7.out b/S2OJ/910/data/city7.out new file mode 100644 index 00000000..5dd6db37 --- /dev/null +++ b/S2OJ/910/data/city7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:af0758abcefb5e1310b61ea80a4a85504391a6fbaed00027e12d3909e1f93096 +size 2665 diff --git a/S2OJ/910/data/city8.in b/S2OJ/910/data/city8.in new file mode 100644 index 00000000..122e057f --- /dev/null +++ b/S2OJ/910/data/city8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94ada43d76f7ffd14caa28c4de0a292e083a43ba266cffeaf15a37952d89d97b +size 425505 diff --git a/S2OJ/910/data/city8.out b/S2OJ/910/data/city8.out new file mode 100644 index 00000000..96012509 --- /dev/null +++ b/S2OJ/910/data/city8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68b4a598901b013a0c896464b1cf663032dcde79a1ff832b77f124d218c056d5 +size 2679 diff --git a/S2OJ/910/data/city9.in b/S2OJ/910/data/city9.in new file mode 100644 index 00000000..069db4aa --- /dev/null +++ b/S2OJ/910/data/city9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47e49b995387c77182535f84e2884efd8665cbf409336bbb5a884946cbe0b8ca +size 427334 diff --git a/S2OJ/910/data/city9.out b/S2OJ/910/data/city9.out new file mode 100644 index 00000000..e881331a --- /dev/null +++ b/S2OJ/910/data/city9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7271b1798aba7e5874062ef091950aec2302a3266cc57358cb2641f5fbb02519 +size 2675 diff --git a/S2OJ/910/data/ex_city1.in b/S2OJ/910/data/ex_city1.in new file mode 100644 index 00000000..7451e691 --- /dev/null +++ b/S2OJ/910/data/ex_city1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0aa7fabb82024ee59eb69db73ea06ca49781fddd26bf1851a43f5781e8d4c435 +size 14 diff --git a/S2OJ/910/data/ex_city1.out b/S2OJ/910/data/ex_city1.out new file mode 100644 index 00000000..f1694beb --- /dev/null +++ b/S2OJ/910/data/ex_city1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08b3ccbc4eabc7e728e86ee37ddf2c23dfde4ffae56c7840898f145e0d71394e +size 10 diff --git a/S2OJ/910/data/ex_city2.in b/S2OJ/910/data/ex_city2.in new file mode 100644 index 00000000..2b7f9702 --- /dev/null +++ b/S2OJ/910/data/ex_city2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2ec93cca9127d2a37c8a8a361fd2cf0e859a95a31e8e482e79e5e80ee4d6cc40 +size 20 diff --git a/S2OJ/910/data/ex_city2.out b/S2OJ/910/data/ex_city2.out new file mode 100644 index 00000000..0fd561aa --- /dev/null +++ b/S2OJ/910/data/ex_city2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71465f04427db3908df2f6380d1b813568802ef5c6164e16c6abc946431fab2b +size 20 diff --git a/S2OJ/910/data/problem.conf b/S2OJ/910/data/problem.conf new file mode 100644 index 00000000..40ca931b --- /dev/null +++ b/S2OJ/910/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8efa306d2597c291af4a08d41e202610643a4e0d1d76528199c4864242c2d87c +size 177