QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#344962 | #8230. Submissions | ucup-team173 | WA | 160ms | 3936kb | C++20 | 3.8kb | 2024-03-05 20:39:41 | 2024-03-05 20:39:42 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN = 1e5 + 5;
struct Team{
string name;
vector<pair<int, int>> sub[26];
pair<int, int> s[26];
pair<int, int> res, bestRes, worstRes;
Team(string name = "") :name(name) {}
void calc() {
int score = 0, time = 0;
for(int p = 0; p < 26; p++) {
int now = -1;
s[p] = make_pair(0, 0);
for(auto [t, sta] : sub[p]) {
if(sta == 1) {
if(now < 0) {
time += (-now - 1) * 20 + t, score++;
s[p] = make_pair(1, (-now - 1) * 20 + t);
now = -now;
}
} else if(now < 0) now--;
}
}
res = make_pair(score, -time);
bestRes = res;
for(int p = 0; p < 26; p++) {
int now = -1, tt = 0, Time = time - s[p].second, Score = score - s[p].first;
for(auto [t, sta] : sub[p]) {
if(now < 0) {
Time += (-now - 1) * 20 + t, Score++, now = -now;
}
}
bestRes = max(bestRes, make_pair(Score, -Time));
}
worstRes = res;
for(int p = 0; p < 26; p++) {
int now = -1, tt = 0, Time = time - s[p].second, Score = score - s[p].first;
for(auto [t, sta] : sub[p]) {
if(sta == 1 && tt != 0) {
if(now < 0) {
Time += (-now - 1) * 20 + t, Score++, now = -now;
}
} else if(now < 0) now--, (sta == 1 ? tt = 1 : 0);
}
worstRes = min(worstRes, make_pair(Score, -Time));
}
}
};
vector<Team> teams;
map<string, int> Id;
int n, m, now;
set<string> ans;
pair<int, int> Calc1(Team Now) {
int time = 0;
for(int p = 0; p < 26; p++) {
int now = -1;
for(auto [t, sta] : Now.sub[p]) {
time = max(time, (-now - 1) * 20 + t), now--;
}
}
return make_pair(1, -time);
}
void solve() {
cin >> m;
for(int i = 1; i <= m; i++) {
string c, p, s;
int t;
cin >> c >> p >> t >> s;
if(!Id.count(c)){
Id[c] = now++;
teams.push_back(Team(c));
}
teams[Id[c]].sub[p[0] - 'A'].emplace_back(t, s[0] == 'a');
}
for(auto&team : teams) team.calc();
sort(teams.begin(), teams.end(), [](Team a, Team b) {return a.res > b.res;});
int cnt = 0, tt = 0;
for(auto o : teams) if(o.res.first) cnt++;
int lim = min(35, (cnt + 9) / 10);
pair<int, int> Upper = make_pair(1e9, 0), NotLower = make_pair(1e9, 0);
if(cnt != now && min(cnt / 10 + 1, 35) > lim) {
for(auto team : teams) if(!team.res.first) {
Upper = min(Upper, Calc1(team));
}
}
for(int i = 0; i < lim; i++) {
if(min((cnt + 8) / 10, 35) == lim || teams[i].worstRes.first != 0) {
NotLower = min(NotLower, teams[i].worstRes);
}
}
for(int i = 0; i < teams.size(); i++) {
if(teams[i].bestRes >= teams[(teams[i].res.first ? lim : min(cnt / 10 + 1, 35)) - 1].res) ans.insert(teams[i].name);
else if(teams[i].res == teams[lim].res && (Upper <= teams[i].res)) {
ans.insert(teams[i].name);
} else if(teams[i].res == teams[lim].res && (NotLower <= teams[i].worstRes)) {
ans.insert(teams[i].name);
}
}
cout << ans.size() << '\n';
for(auto name : ans) cout << name << ' ';
cout << '\n';
now = 0, Id.clear(), ans.clear(), teams.clear();
}
int main() {
// ios :: sync_with_stdio(0);
// cin.tie(0), cout.tie(0);
int t; cin >> t;
for(; t--; ) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3608kb
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:
2 TS1 TSxingxing10 4 AllWayTheNorth ImYourFan LetItRot XuejunXinyoudui1
result:
ok 2 test cases ok. (2 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3904kb
input:
2 2 jiangly_fan A 1 accepted jiangly B 23 accepted 3 conqueror_of_tourist A 1 accepted conqueror_of_tourist A 2 accepted tourist B 23 accepted
output:
2 jiangly jiangly_fan 1 conqueror_of_tourist
result:
ok 2 test cases ok. (2 test cases)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
2 13 A A 1 accepted A X 1 accepted K K 1 rejected B B 2 accepted C C 2 accepted D D 2 accepted E E 2 accepted F F 2 accepted G G 2 accepted H H 2 accepted I I 2 accepted J J 2 accepted K K 2 rejected 12 A A 1 accepted A X 1 accepted B B 2 accepted C C 2 accepted D D 2 accepted E E 2 accepted F F 2 a...
output:
11 A B C D E F G H I J K 1 A
result:
ok 2 test cases ok. (2 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
2 11 A A 1 accepted B B 1 accepted C C 2 accepted D D 2 accepted E E 2 accepted F F 2 accepted G G 2 accepted H H 2 accepted I I 2 accepted J J 2 accepted K K 2 accepted 12 A A 1 accepted A X 1 accepted K K 1 rejected B B 2 accepted C C 2 accepted D D 2 accepted E E 2 accepted F F 2 accepted G G 2 a...
output:
2 A B 2 A K
result:
ok 2 test cases ok. (2 test cases)
Test #5:
score: 0
Accepted
time: 160ms
memory: 3680kb
input:
100000 1 M3JytWoaEXxkACy_mBAQ R 111 accepted 1 sQ O 151 accepted 1 JinbrcS58gNEE5yTSkT B 140 accepted 1 cklwBY V 243 accepted 1 v_o42YmvEKFwy Q 260 rejected 1 ftQVK8S_um22w K 265 accepted 1 _bQBeFeDpYQhvZcLf9l3 Z 147 accepted 1 KvDcEAIDN A 75 rejected 1 H3MUK6 A 101 rejected 1 gxYo_oCFn2J8aIben U 54...
output:
1 M3JytWoaEXxkACy_mBAQ 1 sQ 1 JinbrcS58gNEE5yTSkT 1 cklwBY 1 v_o42YmvEKFwy 1 ftQVK8S_um22w 1 _bQBeFeDpYQhvZcLf9l3 1 KvDcEAIDN 1 H3MUK6 1 gxYo_oCFn2J8aIben 1 _isnlUGK0ddI 1 BERcVjyCp 1 6In2do_50ylch 1 f0r3SXc6brMjT 1 7njYOapSwvogA 1 x 1 y1w3KvxylfxwprRBYw 1 aGedzS 1 iPo0GDhIF 1 4Vf...
result:
ok 100000 test cases ok. (100000 test cases)
Test #6:
score: -100
Wrong Answer
time: 137ms
memory: 3936kb
input:
10000 42 Bzs0PiQMXGZ5rRZ_2D G 2 accepted 9XtB_VIfbRRL E 11 accepted FVJL M 13 rejected a S 19 accepted tsd Z 20 rejected MyCqVEg1ONjZ U 22 accepted 6SgZMn N 51 rejected Qua1Pti3vKhyQKDUm P 54 accepted i29 M 63 accepted zPqu D 68 rejected xx2yiu6x C 71 rejected fYuK1KNkuyO5HRCq L 76 rejected tXWpYVqj...
output:
3 Qua1Pti3vKhyQKDUm fYuK1KNkuyO5HRCq tsd 2 JP t3 1 fhYPGC8W82NwJTQL 2 3BQ pVWDEz 2 buCeoOotAkV8DaFD6 tg 1 UkXQ3iaNJ 1 vwfw 1 QTEzV6tp 3 4e1l0pO8eFjZwkDo 9cy_y_RNRwex8j7224hz wJlbqIU 1 eiuF7a_ 1 xy6QBr8ECi 3 PezeyUurYoz7N1iGU _Yej1PrINtydmOudwoO ldaKLZb1oS1sS 4 ExPS1wRii Lanp2 idqV8NpJrCL...
result:
wrong answer the numbers are different in the case 1. (test case 1)