QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#396279#8230. SubmissionsqawszxWA 68ms69168kbC++143.5kb2024-04-22 16:47:132024-04-22 16:47:14

Judging History

你现在查看的是最新测评结果

  • [2024-05-20 23:50:57]
  • hack成功,自动添加数据
  • (/hack/623)
  • [2024-05-20 23:48:44]
  • hack成功,自动添加数据
  • (/hack/622)
  • [2024-04-22 16:47:14]
  • 评测
  • 测评结果:WA
  • 用时:68ms
  • 内存:69168kb
  • [2024-04-22 16:47:13]
  • 提交

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];
      if (!res[i][j][0].first) res[i][j][1] = {1, (*subm[i][j].rbegin()).first};
    }
    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;
    for (int j: it.second) rk[j] = ++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; int until = 0; bool selfGold = false;
        for (auto &it: rklist) {
          if (t >= _gold) break;
          t += it.second.size() - (it.first == sum[i]);
          until += it.second.size() - (it.first == _sum);
          if (it.first == _sum) selfGold = true;
        }
        if (!selfGold && rk[i] <= until)
          r[1] = max(r[1], rk[i] - 1),
          r[rk[i] + 1] = max(r[rk[i] + 1], until);
        else r[1] = max(r[1], until);
        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;
}

详细

Test #1:

score: 100
Accepted
time: 7ms
memory: 68208kb

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 XuejunXinyoudui1 LetItRot ImYourFan 

result:

ok 2 test cases ok. (2 test cases)

Test #2:

score: 0
Accepted
time: 11ms
memory: 69160kb

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_fan jiangly 
1
conqueror_of_tourist 

result:

ok 2 test cases ok. (2 test cases)

Test #3:

score: 0
Accepted
time: 8ms
memory: 69168kb

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: 8ms
memory: 68232kb

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: 68ms
memory: 67824kb

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: 60ms
memory: 68200kb

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:

4
Qua1Pti3vKhyQKDUm fYuK1KNkuyO5HRCq xiLm0TUOF3T tsd 
2
t3 JP 
2
fhYPGC8W82NwJTQL 77sgqpbTIr_Zt1 
2
pVWDEz 3BQ 
2
tg buCeoOotAkV8DaFD6 
1
UkXQ3iaNJ 
2
vwfw ALTqPt7JUSLrl 
1
QTEzV6tp 
3
9cy_y_RNRwex8j7224hz wJlbqIU 4e1l0pO8eFjZwkDo 
2
eiuF7a_ 6mbCu5zA 
1
xy6QBr8ECi 
3
ldaKLZb1oS1sS PezeyUurYoz7N1iGU ...

result:

wrong answer the numbers are different in the case 7272. (test case 7272)