QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#396266 | #8230. Submissions | qawszx | WA | 15ms | 69256kb | C++14 | 3.3kb | 2024-04-22 16:15:21 | 2024-04-22 16:15:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
struct pii {
int first, second;
pii() {}
pii(int _x, int _y): first(_x), second(_y) {}
bool operator < (const pii &B) const { return first == B.first ? second < B.second : first > B.first; }
bool operator == (const pii &B) const { return first == B.first && second == B.second; }
bool operator != (const pii B) const { return first != B.first || second != B.second; }
pii operator + (pii B) { return pii(first + B.first, second + B.second); }
pii operator - (pii B) { return pii(first - B.first, second - B.second); }
};
const int N = 1e5 + 5;
int T, m, n, _n, gold, r[N], rk[N];
string name[N]; map<string, int> dict;
vector<pair<int, bool>> subm[N][26];
pii sum[N], res[N][26][3]; map<pii, vector<int>> rklist;
void mian() {
cin >> m;
n = 0, dict.clear();
while (m--) {
string team, prob, stat; int when;
cin >> team >> prob >> when >> stat;
if (dict.find(team) == dict.end()) {
name[++n] = team, dict[team] = n;
for (int j = 0; j < 26; ++j) subm[n][j].clear();
}
int id = dict[team];
subm[id][prob[0] - 'A'].emplace_back(when, stat[0] == 'a');
}
_n = 0, rklist.clear();
for (int i = 1; i <= n; ++i) {
sum[i] = {0, 0};
for (int j = 0; j < 26; ++j) if (!subm[i][j].empty()) {
res[i][j][0] = res[i][j][1] = {0, 0};
res[i][j][2] = {1, subm[i][j][0].first};
int tries = 0, accpt = 0;
for (auto it: subm[i][j]) {
if (it.second) {
++accpt;
if (accpt == 1) res[i][j][0] = pii(1, it.first + 20 * tries);
else { res[i][j][1] = pii(1, it.first + 20 * tries); break; }
}
else ++tries;
}
sum[i] = sum[i] + res[i][j][0];
}
rklist[sum[i]].emplace_back(i);
if (sum[i].first) ++_n;
}
gold = min((_n + 9) / 10, 35);
for (int i = 2; i <= n; ++i) r[i] = 0;
int t = 0;
for (auto &it: rklist) {
int _t = t;
if (_t < gold) r[1] = t;
}
for (int i = 1; i <= n; ++i) {
for (int j = 0; j < 26; ++j) if (!subm[i][j].empty()) {
for (int k = 1; k < 3; ++k) if (res[i][j][0] != res[i][j][k]) {
pii _sum = sum[i] - res[i][j][0] + res[i][j][k];
int _gold = gold;
if (sum[i].first && !_sum.first) _gold = min((_n + 8) / 10, 35);
if (!sum[i].first && _sum.first) _gold = min((_n + 10) / 10, 35);
rklist[_sum].emplace_back(i);
t = 0; bool selfGold = false;
for (auto &it: rklist) {
if (t >= _gold) break;
t += it.second.size() - (it.first == sum[i]);
if (it.first == _sum) selfGold = true;
}
if (!selfGold && rk[i] < t)
r[1] = max(r[1], rk[i] - 1),
r[rk[i] + 1] = max(r[rk[i] + 1], t);
else rk[1] = max(rk[1], t);
if (selfGold) r[rk[i]] = max(r[rk[i]], rk[i]);
rklist[_sum].pop_back();
if (rklist[_sum].empty()) rklist.erase(_sum);
}
}
}
t = 0;
for (int i = 1, mx = 0; i <= n; ++i)
mx = max(mx, r[i]), t += i <= mx;
cout << t << '\n';
int i = 0, mx = 0;
for (auto &it: rklist) for (int j: it.second) {
mx = max(mx, r[++i]); if (i <= mx) cout << name[j] << ' ';
}
cout << '\n';
}
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> T; while (T--) mian();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 15ms
memory: 69256kb
input:
2 5 TSxingxing10 G 0 rejected TSxingxing10 B 83 accepted aoliaoligeiliao J 98 accepted TS1 J 118 accepted TS1 B 263 accepted 12 AllWayTheNorth A 0 rejected YaoYaoLingXian Y 10 accepted XuejunXinyoudui1 X 200 rejected XuejunXinyoudui1 X 200 accepted LetItRot L 215 accepted AllWayTheNorth W 250 accept...
output:
1 TS1 4 AllWayTheNorth XuejunXinyoudui1 LetItRot ImYourFan
result:
wrong answer the numbers are different in the case 1. (test case 1)