0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 14:16:28 +00:00

#1657. 【2022 正睿 CSP 七连测 Day 5】Game

https://sjzezoj.com/submission/61318
This commit is contained in:
Baoshuo Ren 2022-10-22 16:53:57 +08:00
parent b391fc6406
commit 590d720691
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
42 changed files with 168 additions and 0 deletions

45
S2OJ/1657/1657.cpp Normal file
View File

@ -0,0 +1,45 @@
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
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<int> 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;
}

BIN
S2OJ/1657/data/game1.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game1.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game10.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game10.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game11.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game11.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game12.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game12.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game13.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game13.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game14.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game14.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game15.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game15.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game16.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game16.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game17.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game17.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game18.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game18.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game19.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game19.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game2.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game2.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game20.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game20.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game3.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game3.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game4.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game4.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game5.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game5.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game6.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game6.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game7.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game7.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game8.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game8.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game9.in (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/game9.out (Stored with Git LFS) Normal file

Binary file not shown.

BIN
S2OJ/1657/data/problem.conf (Stored with Git LFS) Normal file

Binary file not shown.