QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#369838#8230. SubmissionsliswtWA 63ms59156kbC++144.0kb2024-03-28 18:30:122024-03-28 18:30:13

Judging History

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

  • [2024-05-20 23:50:57]
  • hack成功,自动添加数据
  • (/hack/623)
  • [2024-05-20 23:48:44]
  • hack成功,自动添加数据
  • (/hack/622)
  • [2024-03-28 18:30:13]
  • 评测
  • 测评结果:WA
  • 用时:63ms
  • 内存:59156kb
  • [2024-03-28 18:30:12]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int T;
int n,m;
int ac;
struct ti
{
	int id,tid,tim,sta;//队伍id,题id,提交时间,是否ac
}o[N];//提交
struct team
{
	string name;//队名
	int id;//队伍id
	int ac;//总ac数
	int penty;//总罚时
	int ac1[26];//第1个ac是第几次提交,0代表没有
	int tim1[26];//第1个ac的时间
	int ac2[26];//第2个ac是第几次提交,0代表没有
	int tim2[26];//第2个ac的时间
	int ti[26];//总提交次数
}a[N];
int b[N];//离散化id
int d[N][26];
bool operator==(const team&a,const team&b){return a.ac==b.ac&&a.penty==b.penty;}
bool operator>(const team&a,const team&b){return a.ac==b.ac?a.penty<b.penty:a.ac>b.ac;}
bool operator<(const team&a,const team&b){return a.ac==b.ac?a.penty>b.penty:a.ac<b.ac;}
bool cmp(const team&a,const team&b){return a.ac==b.ac?a.penty<b.penty:a.ac>b.ac;}
void solve()
{
	set<int>ans;
	map<string,int>id;
	a[0].ac=-1;
	cin>>m;//提交数量
	n=0;//队伍数量
	ac=0;//至少过1题的队伍数量
	for(int i=1;i<=m;i++)
	{
		int t;
		string c,p,s;
		cin>>c>>p>>t>>s;
		if(id[c]==0)
		{
			n++;
			id[c]=n;
			a[n].name=c;
			a[n].id=n;
			a[n].ac=0;
			a[n].penty=0;
			for(int j=0;j<26;j++)
			{
				a[n].ac1[j]=0;
				a[n].tim1[j]=0;
				a[n].ac2[j]=0;
				a[n].tim2[j]=0;
				a[n].ti[j]=0;
			}
		}
		int u=id[c];
		o[i].id=u;
		o[i].tid=p[0]-'A';
		o[i].tim=t;
		o[i].sta=s[0]=='a'?1:0;
		int v=o[i].tid;
		a[u].ti[v]++;
		if(o[i].sta)
		{
			if(a[u].ac1[v]==0)
			{
				a[u].ac1[v]=a[u].ti[v];
				a[u].tim1[v]=(a[u].ti[v]-1)*20+t;
				a[u].ac++;
				a[u].penty+=a[u].tim1[v];
			}
			else if(a[u].ac2[v]==0)
			{
				a[u].ac2[v]=a[u].ti[v];
				a[u].tim2[v]=(a[u].ti[v]-1)*20+t;
			}	
		}
	}
	if(n==1)
	{
		cout<<1<<endl<<a[1].name<<endl;
		return;
	}
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
//		cout<<a[i].name<<" "<<a[i].ac<<" "<<a[i].penty<<endl;
//		for(int j=0;j<26;j++)
//		{
//			cout<<char(j+'A')<<" ";
//			cout<<a[i].ac1[j]<<" ";
//			cout<<a[i].tim1[j]<<" ";
//			cout<<a[i].ac2[j]<<" ";
//			cout<<a[i].tim2[j]<<" ";
//			cout<<a[i].ti[j]<<" ";
//			cout<<endl;
//		}
		
		if(a[i].ac)ac++;
		b[a[i].id]=i;
		for(int j=0;j<26;j++)
		{
			d[i][j]=0;
		}
	}
	int M=min((ac+9)/10,35);
	for(int j=1;j<=M;j++)
	{
		ans.insert(a[j].id);
	}
	for(int j=M+1;j<=n;j++)
	{
		if(a[j]==a[j-1])ans.insert(a[j].id);
		else break;
	}
	int over=0;
	for(int i=1;i<=m;i++)
	{
		int k=b[o[i].id];
		auto v=o[i].tid;
		auto tmp=a[k];
		
		d[k][v]++;
		int acc=0;
		
		if(!a[k].ac1[v])
		{
			if(a[k].ac==0)acc=1;
			a[k].ac++;
			a[k].penty+=(d[k][v]-1)*20+o[i].tim;
		}
		else
		{
			if(d[k][v]<a[k].tim1[v])
			{
				a[k].penty-=a[k].tim1[v];
				a[k].penty+=(d[k][v]-1)*20+o[i].tim;
			}
			else if(d[k][v]==a[k].tim1[v])
			{
				if(a[k].ac2[v])
				{
					a[k].penty-=a[k].tim1[v];
					a[k].penty+=a[k].tim2[v];
				}
				else
				{
//					cout<<"***"<<i<<endl;
					if(a[k].ac==1)acc=-1;
					a[k].ac--;
					a[k].penty-=a[k].tim1[v];
				}
			}
			else
			{
				continue;
			}
		}
		
		int M=min((ac+acc+9)/10,35);
		int used=0;
		int re=0;
		for(int j=1,cnt=1;cnt<=M;)
		{
//			cout<<i<<" "<<j<<" "<<k<<" "<<cnt<<" "<<M<<endl;
			if(j==k){j++;continue;}
			if(!used)
			{
				if(!(a[k]<a[j]))
				{
					used=1;
					ans.insert(a[k].id);
					cnt++;
					re=-1;
					continue;
				}
			}
			ans.insert(a[j].id);
			cnt++;
			j++;
		}
		for(int j=M+re+1;j<=n;j++)
		{
			if(j>=40&&over==2)break;
			if(j>=40)over=1;
			if(a[j]==a[j-1])ans.insert(a[j].id);
			else break;
		}
		if(over)over=2;
		a[k]=tmp;
		
//		cout<<i<<endl;
//		cout<<ans.size()<<endl;
//		for(auto x:ans)cout<<a[b[x]].name<<" ";
//		cout<<endl;
	}
	cout<<ans.size()<<endl;
	for(auto x:ans)cout<<a[b[x]].name<<" ";
	cout<<endl;
}
int main()
{
	cin.tie(0)->sync_with_stdio(false);
	cout.tie(0)->sync_with_stdio(false);
	cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 59072kb

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

result:

ok 2 test cases ok. (2 test cases)

Test #2:

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

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: 0ms
memory: 59120kb

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

result:

ok 2 test cases ok. (2 test cases)

Test #4:

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

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: 63ms
memory: 59156kb

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: -100
Wrong Answer
time: 61ms
memory: 59032kb

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
tsd Qua1Pti3vKhyQKDUm fYuK1KNkuyO5HRCq 
1
t3 
1
fhYPGC8W82NwJTQL 
2
pVWDEz 3BQ 
2
tg buCeoOotAkV8DaFD6 
1
UkXQ3iaNJ 
1
vwfw 
1
QTEzV6tp 
3
4e1l0pO8eFjZwkDo wJlbqIU 9cy_y_RNRwex8j7224hz 
1
eiuF7a_ 
1
xy6QBr8ECi
2
ldaKLZb1oS1sS _Yej1PrINtydmOudwoO 
4
idqV8NpJrCLCR Lanp2 ExPS1wRii xWftOcg5PEA 
1
QSeH...

result:

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