QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#641134 | #8230. Submissions | Tomorrow | WA | 0ms | 3592kb | C++17 | 2.8kb | 2024-10-14 18:47:11 | 2024-10-14 18:47:11 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define C const
#define OP operator
#define pb push_back
#define ft first
#define sd second
#define TTT template<typename T = I>
#define BE(v) v.begin(), v.end()
#define VD void
#define I int
#define STR string
using PII = pair<I, I>;
TTT using V = vector<T>;
#define FORX(v) for(auto& x : v)
#define FOR(i, b, e) for(auto i = b, _e = (decltype(i))e;i != _e; ++i)
#define FORR(i, b, e) for(auto i = b, _e = (decltype(i))e;i != _e; --i)
#define FORV(v, i) for (I i = 0, _n = v.size(), x = _n ? v[0] : 0;i < _n;x = v[++i])
#define FUNC(T, f, ...) function<T(__VA_ARGS__)> f = [&](__VA_ARGS__)->T
TTT VD setmin(T& a, C T& b) { if (b < a)a = b; }
TTT VD setmax(T& a, C T& b) { if (a < b)a = b; }
VD test()
{
I n = 0, m; cin >> m;
unordered_map<STR, I> ns;
V<STR> tn;
V<V<V<I>>> tm;
FOR(i, 0, m)
{
STR nm, pl, st; I t; cin >> nm >> pl >> t >> st;
if (!ns.count(nm))ns[nm] = n++, tn.pb(nm), tm.pb(V<V<I>>(26));
tm[ns[nm]][pl[0] - 'A'].pb(st == "accepted" ? ~t : t);
}
FUNC(V<PII>, calc, V<I>&v, PII & s)//s = { 0,0 };
{
I n = v.size(), fa = -1;
V<PII> res(n);
FORR(i, n - 1, -1)if (v[i] < 0)res[i] = s, s = { -1,i * 20 + ~v[i] }, fa = i;
FOR(i, 0, n)
{
if (v[i] < 0 && i != fa)res[i] = s;
if (v[i] >= 0)res[i] = min(s, { -1,i * 20 + v[i] });
}
return res;
};
V<PII> sc(n); V<V<PII>> dlt(n);
FOR(i, 0, n)
{
FOR(j, 0, 26)
{
PII b; V<PII> r = calc(tm[i][j], b);
sc[i].ft += b.ft, sc[i].sd += b.sd;
FORX(r)dlt[i].pb({ x.ft - b.ft,x.sd - b.sd });
}
}
I sn = 0;
FOR(i, 0, n)if (sc[i].ft < 0)++sn;
V<I> rk(n), vs(n);
V<PII> ss(sc); sort(BE(ss));
FOR(i, 0, n)rk[i] = lower_bound(BE(ss), sc[i]) - ss.begin();
PII lgs = { -100 ,-1e9 };
FOR(i, 0, n)
{
if (rk[i] < min((int)ceil(sn * 0.1), 35))vs[i] = 1;
FOR(j, 0, dlt[i].size())
{
PII ns = dlt[i][j];
ns.ft += sc[i].ft, ns.sd += sc[i].sd;
I nsn = sn;
if (sc[i].ft == 0 && ns.ft < 0)++nsn;
if (sc[i].ft < 0 && ns.ft == 0)--nsn;
I gn = min((int)ceil(nsn * 0.1), 35);
I nr = lower_bound(BE(ss), ns) - ss.begin();
if (nr > rk[i])--nr;
if (nr < gn)vs[i] = 1;
if (gn == 0)continue;
// V<PII> g;
// FOR(k, 0, min(40, n))if (rk[i] != k)g.pb(ss[k]);
// g.pb(ns);
// sort(BE(g));
// setmax(lgs, g[gn - 1]);
setmax(lgs, ss[gn - 1 + (rk[i] < gn) - (nr <= gn)]);
}
}
FOR(i, 0, n)if (sc[i] <= lgs)vs[i] = 1;
I ans = 0;
FOR(i, 0, n)if (vs[i])++ans;
cout << ans << '\n';
FOR(i, 0, n)if (vs[i])cout << tn[i] << ' ';
cout << '\n';
}
I main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
if (fopen("test.in", "r"))
{
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
}
I t = 1;
cin >> t;
while (t--)test();
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3592kb
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:
3 TSxingxing10 aoliaoligeiliao TS1 4 AllWayTheNorth XuejunXinyoudui1 LetItRot ImYourFan
result:
wrong answer the numbers are different in the case 1. (test case 1)