diff --git a/S2OJ/1657/1657.cpp b/S2OJ/1657/1657.cpp new file mode 100644 index 00000000..79b70ed6 --- /dev/null +++ b/S2OJ/1657/1657.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +#include + +using std::cin; +using std::cout; +const char endl = '\n'; + +const int N = 1e5 + 5; + +int main() { + std::ios::sync_with_stdio(false); + cin.tie(nullptr); + + int n; + long long ans = 0; + std::vector a; + + cin >> n; + + for (int i = 1, x; i <= n; i++) { + cin >> x; + + if (x > 0) { + ans += x; + } else { + a.emplace_back(x); + } + } + + std::sort(a.begin(), a.end(), std::greater<>()); + + long long sum1 = 0, sum2 = 0; + + for (int i = 0; i < a.size(); i++) { + if (i & 1) sum1 += a[i]; + else sum2 += a[i]; + } + + if (a.size() == n) cout << std::max(sum1 + a[0], sum2) << endl; + else cout << ans + std::max(sum1, sum2) << endl; + + return 0; +} diff --git a/S2OJ/1657/data/game1.in b/S2OJ/1657/data/game1.in new file mode 100644 index 00000000..eecf7f5c --- /dev/null +++ b/S2OJ/1657/data/game1.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9cc84cc92f0f2a258484f23134568eecc0721c5f6714f72f14492e91e5c0f93 +size 10 diff --git a/S2OJ/1657/data/game1.out b/S2OJ/1657/data/game1.out new file mode 100644 index 00000000..e0ac5f87 --- /dev/null +++ b/S2OJ/1657/data/game1.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed1b8325b70e3c00b253d8fd48a2cc5e933e111d7d0ace721eff30e18f985542 +size 4 diff --git a/S2OJ/1657/data/game10.in b/S2OJ/1657/data/game10.in new file mode 100644 index 00000000..858e8b98 --- /dev/null +++ b/S2OJ/1657/data/game10.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f9bbfb6cb093c598e45b62e01b2d6bbbdb25d05fd9aac21e7801497da0c5aebc +size 4633488 diff --git a/S2OJ/1657/data/game10.out b/S2OJ/1657/data/game10.out new file mode 100644 index 00000000..f034a0f6 --- /dev/null +++ b/S2OJ/1657/data/game10.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43ac6e189403a6cbb2edf3efde332f960dd9ac39bac7061dd7c1147604142aae +size 13 diff --git a/S2OJ/1657/data/game11.in b/S2OJ/1657/data/game11.in new file mode 100644 index 00000000..7e62cdfc --- /dev/null +++ b/S2OJ/1657/data/game11.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:16f21d8747411dc510ec647d4e3ec8994160d32defea5c03f6c58ff03b8457ac +size 23 diff --git a/S2OJ/1657/data/game11.out b/S2OJ/1657/data/game11.out new file mode 100644 index 00000000..c4968dd6 --- /dev/null +++ b/S2OJ/1657/data/game11.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2451e722f881c88d56d145dd4d7953045b2798fb9a0beee6319b8ebbfdd47873 +size 4 diff --git a/S2OJ/1657/data/game12.in b/S2OJ/1657/data/game12.in new file mode 100644 index 00000000..914ba57c --- /dev/null +++ b/S2OJ/1657/data/game12.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a25592c8c1d354edeb45d44bf3a04f4d598e36f20700c99961b6606370a2632 +size 3881189 diff --git a/S2OJ/1657/data/game12.out b/S2OJ/1657/data/game12.out new file mode 100644 index 00000000..98444cf6 --- /dev/null +++ b/S2OJ/1657/data/game12.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a0b92201620e959faa1d9fb445e25ae14a6215f2c3a3a19244833c045768ce5 +size 14 diff --git a/S2OJ/1657/data/game13.in b/S2OJ/1657/data/game13.in new file mode 100644 index 00000000..6ae925e4 --- /dev/null +++ b/S2OJ/1657/data/game13.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:589aa733474b3d4fea6a37f9081b6418daf82973e38c9ea03c4ccb70f7da7854 +size 5186366 diff --git a/S2OJ/1657/data/game13.out b/S2OJ/1657/data/game13.out new file mode 100644 index 00000000..04ffae3e --- /dev/null +++ b/S2OJ/1657/data/game13.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e0dc577a29c5edb407c93a656e60ae8c17a3b88ac0f429155e8f116600a889bb +size 14 diff --git a/S2OJ/1657/data/game14.in b/S2OJ/1657/data/game14.in new file mode 100644 index 00000000..885caab3 --- /dev/null +++ b/S2OJ/1657/data/game14.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ccf961abd7584cbb70f052d7f87ca7c902fd87a9275d0b65a17884c8af8c566 +size 4574956 diff --git a/S2OJ/1657/data/game14.out b/S2OJ/1657/data/game14.out new file mode 100644 index 00000000..77f6ab92 --- /dev/null +++ b/S2OJ/1657/data/game14.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd394a3ee99bb1c3531846cce01e5f99b7406f897df4f9e8591c2959db218f70 +size 14 diff --git a/S2OJ/1657/data/game15.in b/S2OJ/1657/data/game15.in new file mode 100644 index 00000000..3ca0d85a --- /dev/null +++ b/S2OJ/1657/data/game15.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:add188c6239babff364c1b8a41cbaa5ff83449f1b3275f7d150d613d3576b100 +size 10388976 diff --git a/S2OJ/1657/data/game15.out b/S2OJ/1657/data/game15.out new file mode 100644 index 00000000..e91a26a9 --- /dev/null +++ b/S2OJ/1657/data/game15.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:126597e7cb8eb51dda1af7000bfc21e8bc8cbe2ca276f0c557ca917b4f5252d6 +size 16 diff --git a/S2OJ/1657/data/game16.in b/S2OJ/1657/data/game16.in new file mode 100644 index 00000000..92884c81 --- /dev/null +++ b/S2OJ/1657/data/game16.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa50da6da0d70065e6b1020b7ef5ba612eb83aa401a6e0b699ff80d364a428bc +size 10389502 diff --git a/S2OJ/1657/data/game16.out b/S2OJ/1657/data/game16.out new file mode 100644 index 00000000..34f875df --- /dev/null +++ b/S2OJ/1657/data/game16.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:036023366334af55da087dc33bc3b9fa40272ab2129218b218a3206e90224eb0 +size 16 diff --git a/S2OJ/1657/data/game17.in b/S2OJ/1657/data/game17.in new file mode 100644 index 00000000..17d7b170 --- /dev/null +++ b/S2OJ/1657/data/game17.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bbc765674b0d02cdc59dab7c03b55bfca1003de557b78e2a5167b8c3cf8f5d67 +size 10389003 diff --git a/S2OJ/1657/data/game17.out b/S2OJ/1657/data/game17.out new file mode 100644 index 00000000..25d88464 --- /dev/null +++ b/S2OJ/1657/data/game17.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:08b6e2266aa65fd663105418473ba205105b2cbee9630d23f2050d06c2d0837d +size 16 diff --git a/S2OJ/1657/data/game18.in b/S2OJ/1657/data/game18.in new file mode 100644 index 00000000..9b2fe8da --- /dev/null +++ b/S2OJ/1657/data/game18.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89f53c6e9b008b0a1436163c69c5d9f83d11fefdc4a4fa450e801622df6ea3df +size 10388510 diff --git a/S2OJ/1657/data/game18.out b/S2OJ/1657/data/game18.out new file mode 100644 index 00000000..c5a821f1 --- /dev/null +++ b/S2OJ/1657/data/game18.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7c46064a864172f57942cbbb80e6527c28f4c9eec50af9b326eae5513b37419d +size 16 diff --git a/S2OJ/1657/data/game19.in b/S2OJ/1657/data/game19.in new file mode 100644 index 00000000..c6f89172 --- /dev/null +++ b/S2OJ/1657/data/game19.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d18b3bbe6d63aa49eb82537ab578ba6df1039731c9b06336314ac121c4ee449 +size 10388645 diff --git a/S2OJ/1657/data/game19.out b/S2OJ/1657/data/game19.out new file mode 100644 index 00000000..1a20b258 --- /dev/null +++ b/S2OJ/1657/data/game19.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa9e4c6ae9ac8c9a19b349a40eb1217af795da388192e156476789f187bafe62 +size 16 diff --git a/S2OJ/1657/data/game2.in b/S2OJ/1657/data/game2.in new file mode 100644 index 00000000..3101a807 --- /dev/null +++ b/S2OJ/1657/data/game2.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0ca3a8219cef51a87bd199fab2bae191950c03c12283f94574b59d56a7272b0e +size 11 diff --git a/S2OJ/1657/data/game2.out b/S2OJ/1657/data/game2.out new file mode 100644 index 00000000..4a45747d --- /dev/null +++ b/S2OJ/1657/data/game2.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f90e0b3538d04df294950dcec75952d7e07f1bb044e73e795c410d677b3c268 +size 3 diff --git a/S2OJ/1657/data/game20.in b/S2OJ/1657/data/game20.in new file mode 100644 index 00000000..5b9936b6 --- /dev/null +++ b/S2OJ/1657/data/game20.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b3c40c69a60798244f6ad49b5c348fae159a26662a3064d2bd59622ab279d01 +size 10388834 diff --git a/S2OJ/1657/data/game20.out b/S2OJ/1657/data/game20.out new file mode 100644 index 00000000..53c77c9d --- /dev/null +++ b/S2OJ/1657/data/game20.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa92882fb2e900b5a94f23f39034f623ac6bbf0f7f3c90ac1952c528879bd46e +size 16 diff --git a/S2OJ/1657/data/game3.in b/S2OJ/1657/data/game3.in new file mode 100644 index 00000000..2f7cffa0 --- /dev/null +++ b/S2OJ/1657/data/game3.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0de1ab92d42d3128549ef83f6fcff16b23c90237c544cf994c71a55d0d622839 +size 17 diff --git a/S2OJ/1657/data/game3.out b/S2OJ/1657/data/game3.out new file mode 100644 index 00000000..517a8bda --- /dev/null +++ b/S2OJ/1657/data/game3.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71f24bf62be4ee171b9cf3b871966bb02bab0739dc01597afab02242a8378c03 +size 3 diff --git a/S2OJ/1657/data/game4.in b/S2OJ/1657/data/game4.in new file mode 100644 index 00000000..4046c6ca --- /dev/null +++ b/S2OJ/1657/data/game4.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea68b9ac9e09c75f09886828a2aa04e37142a371d67f93e447211f0e03acf5d9 +size 3759 diff --git a/S2OJ/1657/data/game4.out b/S2OJ/1657/data/game4.out new file mode 100644 index 00000000..1d7dfe67 --- /dev/null +++ b/S2OJ/1657/data/game4.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:58fb0c58f180ff9e9082600124e29be688812efb8d93cb51b873befeee5b3426 +size 9 diff --git a/S2OJ/1657/data/game5.in b/S2OJ/1657/data/game5.in new file mode 100644 index 00000000..98742ce0 --- /dev/null +++ b/S2OJ/1657/data/game5.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:91c0f212596c68533d9268f39ee9f53d931fa95349e8075b491f3bf5911de324 +size 744 diff --git a/S2OJ/1657/data/game5.out b/S2OJ/1657/data/game5.out new file mode 100644 index 00000000..5d37709a --- /dev/null +++ b/S2OJ/1657/data/game5.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84855cac49496a821a3d6f3ad244179d22da7abffb6851443e3e3cc2b8918f98 +size 9 diff --git a/S2OJ/1657/data/game6.in b/S2OJ/1657/data/game6.in new file mode 100644 index 00000000..2771c83e --- /dev/null +++ b/S2OJ/1657/data/game6.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca080880ffc171a1d9039c9f5992c0bf1ad335889013a124c360c0061d55ee1c +size 7081 diff --git a/S2OJ/1657/data/game6.out b/S2OJ/1657/data/game6.out new file mode 100644 index 00000000..24eafd5d --- /dev/null +++ b/S2OJ/1657/data/game6.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:90d51bfaaa1ccf2dea035d30423f219b94a1aee9630adc8ab5ae797ce7d30f57 +size 10 diff --git a/S2OJ/1657/data/game7.in b/S2OJ/1657/data/game7.in new file mode 100644 index 00000000..508a4fb2 --- /dev/null +++ b/S2OJ/1657/data/game7.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29bed33b786dd41aaf28adea774ca21a1d992a46f9adacdf1faf24c957c54cab +size 6146815 diff --git a/S2OJ/1657/data/game7.out b/S2OJ/1657/data/game7.out new file mode 100644 index 00000000..9a2c94a0 --- /dev/null +++ b/S2OJ/1657/data/game7.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ecf844e4f6be2da32230e6fc41714793ab8e2672843f065b216b0886c9f6cc5f +size 13 diff --git a/S2OJ/1657/data/game8.in b/S2OJ/1657/data/game8.in new file mode 100644 index 00000000..8d5f207f --- /dev/null +++ b/S2OJ/1657/data/game8.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:139a277eed16f48d38d1b501f49cd58797c64956589a878ae31b2434ab1d739f +size 531547 diff --git a/S2OJ/1657/data/game8.out b/S2OJ/1657/data/game8.out new file mode 100644 index 00000000..b460c1cd --- /dev/null +++ b/S2OJ/1657/data/game8.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4970c3d41f10d907790138557d1ca60e52193f97dfebf83d360c053418a01934 +size 12 diff --git a/S2OJ/1657/data/game9.in b/S2OJ/1657/data/game9.in new file mode 100644 index 00000000..1365bbdb --- /dev/null +++ b/S2OJ/1657/data/game9.in @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ec86957a4af75fe978b2173b0ab09708bfb59f727408942d793415e983fbeb70 +size 2819267 diff --git a/S2OJ/1657/data/game9.out b/S2OJ/1657/data/game9.out new file mode 100644 index 00000000..9fefc571 --- /dev/null +++ b/S2OJ/1657/data/game9.out @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:698893c65b8ca2378d2ae2326d86df3f5d30adb2cb4871587c41b8c53bc38390 +size 13 diff --git a/S2OJ/1657/data/problem.conf b/S2OJ/1657/data/problem.conf new file mode 100644 index 00000000..7a624f0b --- /dev/null +++ b/S2OJ/1657/data/problem.conf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab103b0741501282e4d3b418d26ea39c59e1fe2389a57c557d38cb2c7b05d16c +size 387