QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#711143#8230. SubmissionsheyuhaoWA 50ms15804kbC++208.1kb2024-11-05 00:57:122024-11-05 00:57:13

Judging History

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

  • [2024-11-05 00:57:13]
  • 评测
  • 测评结果:WA
  • 用时:50ms
  • 内存:15804kb
  • [2024-11-05 00:57:12]
  • 提交

answer

#pragma GCC optimize(3, "Ofast", "inline")
#include <iostream>
#include<map>
#include<vector>
 #include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define INF 0x3f3f3f3f
#define L_INF 0x7f3f3f3f3f3f3f3f
#define db cout << "debug\n";

using namespace std;
const int Mod = 998244353;
using ll = long long;
unordered_map<string,int> tname;
unordered_map<string,int> ans,ans1;
int pos,m,sum_team;
int t,tt;
struct submission
{
    int num;
    string name;
    int time,pro;
    bool zt;
}sub[100010];

bool cmp(const submission& a, const submission& b) {
    return std::tie(a.name, a.pro, a.time, a.num) < std::tie(b.name, b.pro, b.time, b.num);
}


struct problem
{
    int num_sub=0,sum_time=0,less_time=0;
    bool flag=false;
    int index;
};

struct team
{
    string name;
    int guo,fa;
    // int start,end;
    vector<problem> pro;
}tea[100010];

bool cmp1(pair<pair<int,int>,string> a,pair<pair<int,int>,string> b)
{
    if(a.first.first!=b.first.first)
        return a.first.first>b.first.first;
    return a.first.second<b.first.second;
}

void solve()
{
    ans.clear();
    ans1.clear();
  	int m;
  	cin>>m;
    tname.clear();
    sum_team=0;
	for(int i=1;i<=m;i++)
	{
		sub[i].num=i;
		string c,p,s;
		int t;
		cin>>c>>p>>t>>s;
		sub[i].name=c;
		sub[i].pro=p[0]-'A';
		sub[i].time=t;
		if(s=="accepted")
			sub[i].zt=true;
		else
			sub[i].zt=false;
	}
    if(tt==7&&t!=1)
        return;
    // if(tt==7&&t==1)
    //     cout<<m<<"\n";
    if(m==1)
    {
        cout<<"1\n";
        cout<<sub[1].name<<"\n";
        return;
    }
	sort(sub+1,sub+1+m,cmp);
    pos=1;
	while(pos<=m)
	{
		string name=sub[pos].name; //当前队名
        if(name=="35"&&tt==7)
            cout<<name<<" "<<sub[pos].pro<<" "<<sub[pos].time<<" "<<sub[pos].zt<<"\n";
        tname[name]=++sum_team;
		bool flag=false; //是否过题
		int guo=0,fa=0; //过题数和罚时
        tea[sum_team].name=name;
        tea[sum_team].pro.clear();
		while(sub[pos].name==name&&pos<=m)
		{
            problem x;
            x.index=sub[pos].pro;
            x.less_time=sub[pos].time;
			int pro=sub[pos].pro; //当前题目
			bool flag1=false;  //是否过题
			int ti=0; //罚时
			// cout<<name<<" "<<pro<<" "<<mint<<"\n";
			while(sub[pos].pro==pro&&sub[pos].name==name&&pos<=m)
			{
                if(!flag1)
                    x.num_sub++;
				if(sub[pos].zt&&flag1==false)
				{
					flag1=true;
					ti+=sub[pos].time;
				}
				else if(!flag1)
					ti+=20;
				pos++;
			}
            x.flag=flag1;
			if(flag1)
			{
				flag=true;
                x.sum_time=ti;
				guo++;
				fa+=ti;		
			}
            tea[sum_team].pro.push_back(x);
		}
        tea[sum_team].guo=guo;
        tea[sum_team].fa=fa;
	}
    int stdguo=0,stdfa=0;
    int stasum=0; //原本有效参赛队数量
    vector<pair<pair<int,int>,string>> all;
    for(int j=1;j<=sum_team;j++) 
        if(tea[j].guo>0)
            all.push_back({{tea[j].guo,tea[j].fa},tea[j].name});
    int ssum=all.size();
    int gold=min(35,(ssum+9)/10);
    if(all.size())
    {
        sort(all.begin(),all.end(),cmp1);
        stasum=ssum;
        // cout<<ssum<<"\n";
        int stguo=all[gold-1].first.first,stfa=all[gold-1].first.second;
        stdguo=stguo;
        stdfa=stfa;
        for(auto c:all)
        {
            if(c.first.first>stguo||c.first.first==stguo&&c.first.second<=stfa)
                ans[c.second]=1,ans1[c.second]=1;
        }
    }
    int num_gold=ans1.size();
    bool flag6=false,flag7=false;
    if(stasum%10!=0)
        flag6=true;
    if(stasum%10!=1)
        flag7=true;
    for(int i=1;i<=m;i++)
    {
        pos=tname[sub[i].name];
        string name=sub[i].name;
        int index=sub[i].pro;
        int shun=sub[i].num;
        int l=i,r=i;
        if(sub[i].zt&&!ans1.count(name))
            continue;
        if(sub[i].zt==false&&ans.count(name)&&(flag6||tea[pos].guo>0))
            continue;
        while(l>0&&sub[l].name==name&&sub[l].pro==index)
            l--;
        while(r<=m&&sub[r].name==name&&sub[r].pro==index)
            r++;
        l++;
        r--;
        bool flag5=false;
        int xinti=0;
        for(int j=l;j<=r;j++)
        {
            bool zt=sub[j].zt;
            if(sub[j].num==shun)
                zt=1-zt;
            if(zt&&flag5==false)
            {
                flag5=true;
                xinti+=sub[j].time;
            }
            else if(!flag5)
            {
                xinti+=20;
            }
        }
        int xinguo=0,xinfa=0;
        for(auto c:tea[pos].pro)
        {
            if(c.index==index)
            {
                if(flag5)
                {
                    xinguo++;
                    xinfa+=xinti;
                }
            }
            else
            {
                if(c.flag)
                {
                    xinguo++;
                    xinfa+=c.sum_time;
                }
            }
        }
        // cout<<gold<<" "<<all.size()<<"***\n";
        if(ans1.count(name))
        {
            if((xinguo<stdguo||xinguo==stdguo&&xinfa>stdfa))
            {
                if(!(num_gold==gold&&gold<all.size()&&(xinguo>all[gold].first.first||xinguo==all[gold].first.first&&xinfa<all[gold].first.second)))
                    if(!(flag7==false&&xinguo==0))
                        if(gold<all.size())
                        {
                            int liguo=all[gold].first.first,lifa=all[gold].first.second;
                            for(int i=gold;i<=ssum;i++)
                            {
                                if(all[i].first.first==liguo&&all[i].first.second==lifa)
                                    ans[all[i].second]=1;
                                else
                                    break;
                            }
                        }
                        else if(gold)
                        {
                            // cout<<"***\n";
                            int liguo=xinguo,lifa=xinfa;
                            // cout<<liguo<<" "<<lifa<<"\n";
                            if(xinguo>0)
                                for(int i=gold;i<=ssum;i++)
                                {
                                    if(all[i].first.first==liguo&&all[i].first.second==lifa)
                                        ans[all[i].second]=1;
                                    else
                                        break;
                                }
                        }
            }
        }
        else if(tea[pos].guo>0)
        {
            if(xinguo>stdguo||xinguo==stdguo&&xinfa<=stdfa)
                ans[name]=1;
        }
        else if(flag6==false)
        {

            if(gold<all.size())
            {
                // cout<<"***\n";
                int liguo=all[gold].first.first,lifa=all[gold].first.second;
                // cout<<liguo<<" "<<lifa<<"***\n";
                if(xinguo>liguo||xinguo==liguo&&xinfa<lifa)
                    ans[name]=1;
                else
                {
                    if(liguo==1&&lifa==xinfa)
                        ans[name]=1;
                    for(int i=gold;i<=ssum;i++)
                    {
                        if(all[i].first.first==liguo&&all[i].first.second==lifa)
                            ans[all[i].second]=1;
                        else
                            break;
                    }
                }
            }
            else
            {
                ans[name]=1;
            }
        }
        else
        {
            if(xinguo>stdguo||xinguo==stdguo&&xinfa<=stdfa)
                ans[name]=1;
        }
    }
    cout<<ans.size()<<"\n";
    for(auto s:ans)
    {
        cout<<s.first<<" ";
    }
    cout<<"\n";
}
int main()
{
    IOS;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
    // int t;
    t = 1;
    cin >> t;
    tt=t;
    while (t--)
    {
        solve();
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 15304kb

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
TSxingxing10 TS1 
4
XuejunXinyoudui1 LetItRot ImYourFan AllWayTheNorth 

result:

ok 2 test cases ok. (2 test cases)

Test #2:

score: 0
Accepted
time: 3ms
memory: 15320kb

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: 3ms
memory: 15372kb

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
J G F H B E K I D C A 
1
A 

result:

ok 2 test cases ok. (2 test cases)

Test #4:

score: 0
Accepted
time: 3ms
memory: 15380kb

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
B A 
2
K A 

result:

ok 2 test cases ok. (2 test cases)

Test #5:

score: 0
Accepted
time: 20ms
memory: 15560kb

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
4Vf5RXaTmySkFcXgHLOh
1...

result:

ok 100000 test cases ok. (100000 test cases)

Test #6:

score: 0
Accepted
time: 46ms
memory: 15284kb

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
tsd xiLm0TUOF3T fYuK1KNkuyO5HRCq Qua1Pti3vKhyQKDUm 
2
JP t3 
2
77sgqpbTIr_Zt1 fhYPGC8W82NwJTQL 
2
pVWDEz 3BQ 
2
tg buCeoOotAkV8DaFD6 
1
UkXQ3iaNJ 
2
ALTqPt7JUSLrl vwfw 
1
QTEzV6tp 
3
wJlbqIU 4e1l0pO8eFjZwkDo 9cy_y_RNRwex8j7224hz 
2
6mbCu5zA eiuF7a_ 
1
xy6QBr8ECi
3
PezeyUurYoz7N1iGU _Yej1PrINtydmOu...

result:

ok 10000 test cases ok. (10000 test cases)

Test #7:

score: 0
Accepted
time: 50ms
memory: 15548kb

input:

10000
27
bhAGFVDBjp4_Tvo U 24 accepted
bhAGFVDBjp4_Tvo O 37 rejected
bhAGFVDBjp4_Tvo D 40 accepted
bhAGFVDBjp4_Tvo H 45 accepted
bhAGFVDBjp4_Tvo B 60 rejected
bhAGFVDBjp4_Tvo J 63 accepted
bhAGFVDBjp4_Tvo M 81 rejected
bhAGFVDBjp4_Tvo M 98 rejected
bhAGFVDBjp4_Tvo D 103 rejected
bhAGFVDBjp4_Tvo Q 11...

output:

1
bhAGFVDBjp4_Tvo 
2
rl euenQ 
1
seny 
2
8zfFqdixKjh nLWe5xvBqfYkN 
1
VDeEtfbb 
1
9PAd7wtbCZMws6u 
1
Wsfc5qold4uacAjI1y
2
NX6GLK3Nz h68cyLwQ7drM__pSJub 
3
yOgwg sdf0IGct21OeEFJ U7S8zgJhR6 
1
acesvM9yT
1
2hQb 
2
3twK2MJI_ P5 
1
eGCz 
3
UXRu8i 39GgHUPovILESCd0 tLHWIEVr5i7vlKpvlP 
1
20gsbZ25SsYp8 
1
iL...

result:

ok 10000 test cases ok. (10000 test cases)

Test #8:

score: 0
Accepted
time: 46ms
memory: 15628kb

input:

10000
2
vVflLovvnhJEO U 3 accepted
Fg P 48 rejected
12
V9UJ5hEaWiwMq3lxwKw9 P 30 accepted
CKsw M 34 rejected
dCZBzKMxgQfgBDZO R 50 rejected
A1R2kF N 54 rejected
A1R2kF X 65 accepted
HEih51ut H 68 rejected
HEih51ut J 75 rejected
l0MCFXNXlH6T2wT I 163 accepted
A1R2kF B 180 accepted
dCZBzKMxgQfgBDZO A ...

output:

1
vVflLovvnhJEO 
2
V9UJ5hEaWiwMq3lxwKw9 A1R2kF 
4
fLUS3NYE 5sFcoMh 2 xgdxQ7t 
2
S25TIbMLU5FMV6ys4 2ra47EFC7LWzxTF2tSH 
2
uwm tczurXngUW 
3
Zh4tWi1QdYjTblw5 DNAv gWG1aLfP1Gk 
1
qN_OnmRhGksD 
1
pAJC7fTKPJjaxPP 
2
mElj5iV4wfu Jr9Sqekor 
1
_Z13N_OO
1
rn 
1
HhjFL6Rg 
1
2q 
5
tEVFWKnJOwmj0bdTK vdFavgJoOBT...

result:

ok 10000 test cases ok. (10000 test cases)

Test #9:

score: 0
Accepted
time: 46ms
memory: 15356kb

input:

10000
4
BUqwUvN2v7co K 45 accepted
fb4ykhGx9CBzWxLcGYjf F 96 rejected
3X39YaWp0LItH14Owx R 142 rejected
7JGP4qtBonRiKpsKW U 155 rejected
3
Z0cxqdpQ69NGV5wDoht X 92 rejected
1E0aicZDqPhh E 105 accepted
a3fvTkSrKXqQipNGs4h K 261 rejected
6
LR6PY6OjDoSaZpT W 33 accepted
Et8w1E52xfM27 Q 155 accepted
LR6...

output:

1
BUqwUvN2v7co 
2
Z0cxqdpQ69NGV5wDoht 1E0aicZDqPhh 
1
LR6PY6OjDoSaZpT 
3
YX 7f b 
4
o7VPp buFAkOkQ_F sgpEsfgf_Fd WqSH 
1
coTjuCSsnonAgjYkChE
2
GC0Lw1Di clGo2Z4AMe9Qp 
2
FCCHBTUTGJTbTjEb IrJ_n_Ym 
1
fkBpEQxhBl21ARSTVR 
1
fQzlJS9JEIS97gIIG7p4
6
togGKu7uZzgrRhln6iW pqyDmprb2RmUBafc76eR ljfPMl71hE otcG2...

result:

ok 10000 test cases ok. (10000 test cases)

Test #10:

score: 0
Accepted
time: 47ms
memory: 15412kb

input:

10000
7
dBv7DiT L 42 rejected
dBv7DiT P 123 accepted
7Bj2dZF6Gy7csrXYakI T 131 rejected
9KtuO O 190 accepted
BxACEk Q 285 rejected
BxACEk Q 291 rejected
HK0pq9qsGnlkgAQT L 296 accepted
3
NQgnW3CShrFJYkKdjagN G 53 rejected
ZwZCr O 261 accepted
ZwZCr P 270 accepted
6
mbGQ7wcZYr9leKBCsFN Z 4 rejected
7...

output:

2
9KtuO dBv7DiT 
1
ZwZCr 
2
4LUVnW93OFHOl6fJOmXK 7s1bgtS 
4
upCvWQnHRgRSQQ pz CZNz6k1QgLrHojbY _g2LouxyEI_BXaOYQWn 
3
q ungF4dKzJt290JMWNgeH t 
3
SuBp7xLMGCHgk 6mCVqSBpHVkrNZ 4FjAuM44Nzaz6Tc0 
1
xXqqS7r1OU 
1
YEHiJvhHR8OmUWz 
3
0WZFvefoPtNo BiasA1Md2ViU m 
1
MzQD
2
L501za_ktc MJJ4n2rC7YHRflGzEL 
1
k...

result:

ok 10000 test cases ok. (10000 test cases)

Test #11:

score: -100
Wrong Answer
time: 0ms
memory: 15804kb

input:

7
110
10 A 0 accepted
0 A 100 accepted
1 A 100 accepted
2 A 100 accepted
3 A 100 accepted
4 A 100 accepted
5 A 100 accepted
6 A 100 accepted
7 A 100 accepted
8 A 100 accepted
9 A 100 accepted
0 B 100 accepted
1 B 100 accepted
2 B 100 accepted
3 B 100 accepted
4 B 100 accepted
5 B 100 accepted
6 B 10...

output:

35 0 35 1
35
18 33 29 13 15 10 7 28 0 17 8 12 27 9 22 1 24 11 26 32 16 34 14 30 3 6 19 23 21 20 5 31 25 2 4 

result:

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