QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#168725 | #5043. Game | absinthe# | RE | 0ms | 0kb | C++20 | 4.1kb | 2023-09-08 20:44:07 | 2023-09-08 20:44:08 |
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<string> split(string s, char delim) {
vector<string> ret;
string cur;
for (auto i : s) {
if (i == delim) {
ret.push_back(cur);
cur = "";
continue;
}
cur += i;
}
ret.push_back(cur);
return ret;
}
void test() {
string inp;
getline(cin, inp);
int lastSubmisson = -1;
vector<int> firstSubmission(10, -1);
int n = stoi(inp);
vector<pair<pair<int, int>, vector<int>>> teams;
vector<pair<int, int>> bob(10);
for (int i = 0; i < n; i++) {
vector<int> times;
int penalty = 0;
getline(cin, inp);
vector<string> ret = split(inp, ',');
assert(ret.size() == 10);
int iter = 0;
int cnt = 0;
for (int i = 0; i < 10; i++) bob[i] = {-1, -1};
for (auto pp : ret) {
if (pp == "-"){
continue;
}
cnt += 1;
vector<string> ab = split(pp, ' ');
assert(ab.size() == 2);
int a = stoi(ab[0]);
int b = stoi(ab[1]);
times.emplace_back(a);
if (firstSubmission[iter] == -1 || firstSubmission[iter] > a) {
firstSubmission[iter] = a;
}
lastSubmisson = max(lastSubmisson, a);
bob[iter] = {a, b};
penalty += a;
penalty += b * 20;
iter += 1;
}
sort(begin(times), end(times));
reverse(begin(times), end(times));
teams.push_back({{-cnt, penalty}, times});
}
teams.pop_back();
sort(begin(teams), end(teams));
vector<int> order(10);
iota(begin(order), end(order), 0);
int ans = 0;
do {
int cnt = 0;
int curTime = 0;
int penalty = 0;
vector<int> times;
int myFirst = -1;
int myLast = -1;
int happy = 0;
for (auto i : order) {
if (bob[i].first == -1) continue;
if (curTime + bob[i].first > 300) break;
cnt += 1;
curTime += bob[i].first;
penalty += curTime;
penalty += bob[i].second * 20;
times.emplace_back(curTime);
myLast = curTime;
if (firstSubmission[i] == -1 || curTime <= firstSubmission[i]) {
happy += 800;
}
if (myFirst == -1){
myFirst = curTime;
}
}
if (myFirst <= *min_element(begin(firstSubmission), end(firstSubmission))) {
happy += 700;
}
sort(begin(times), end(times));
reverse(begin(times), end(times));
auto me = pair(pair(-cnt, penalty), times);
auto it = lower_bound(begin(teams), end(teams), me) - begin(teams);
it += 1;
if (it <= n / 10) {
happy += 1200;
} else if (it <= 3 * n / 10) {
happy += 800;
} else if (it <= 6 * n / 10) {
happy += 400;
}
if (myLast >= lastSubmisson) {
happy += 500;
}
happy += 5000/it;
ans = max(ans, happy);
} while (next_permutation(begin(order), end(order)));
cout << ans << '\n';
// for (int i = 0; i < 10; i++) {
// cout << firstSubmission[i] << ' ';
// }
// cout << '\n';
// for (auto x : teams) {
// cout << -x.first.first << ' ' << x.first.second << '\n';
// }
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T=1;
// cin >> T;
while (T--) {
test();
}
}
/*
10
233 1,-,-,7 7,257 4,173 5,117 1,-,-,85 3
-,231 0,167 0,257 7,-,-,122 4,283 0,215 4,-
41 1,-,290 8,-,-,-,-,246 7,120 3,184 9
142 8,243 7,69 0,-,41 9,-,279 1,264 4,-,74 9
53 8,-,187 9,60 1,48 8,99 10,-,-,55 7,259 5
250 0,-,-,-,166 0,16 3,-,82 4,73 0,184 3
-,-,-,-,105 3,-,-,-,152 4,-
-,84 5,98 8,-,120 8,241 3,94 1,-,28 7,109 8
280 6,246 5,58 9,-,-,-,-,-,-,-
38 10,-,227 10,187 9,182 1,-,203 9,254 7,-,-
*/
詳細信息
Test #1:
score: 0
Dangerous Syscalls
input:
4 40 39 38 38 37 37 36 36 35 35 34 34 34 33 33 33 32 32 32 31 31 31 30 30 34 31 36 33 31 39 37 38 35 32 32 35 36 31 34 32 38 40 30 33 30 34 33 37 37 30 40 38 36 38 32 34 36 35 37 32 34 33 31 30 33 31 35 34 33 39 31 32 30 33 32 39 37 38 35 40 34 30 31 37 31 33 31 33 34 32 36 36 35 34 32 38