10pts 求助
查看原帖
10pts 求助
1098831
OIratrace楼主2024/6/25 14:25

样例都过了,不知道为什么只有 1010 pts?pts?

#include<bits/stdc++.h>
#define int long long
using namespace std;
struct node
{
	bool used;
	int tmes;
}f[200005][30];
struct O
{
	int A,T,N;
	bool friend operator < (O x,O y)
	{
		if (x.A==y.A)
		{
			if (x.T==y.T)
			{
				return x.N<y.N;
			}
			return x.T<y.T;
		}
		return x.A>y.A;
	}
}o,oo;
struct student
{
	int tm;
	bool ACer;
}st[30][200005];
priority_queue<O> s;
string times,team;
char name;
int n,m,k,cnt;
string result;
string NN[200005];
map<string,int> q;
bool vis[25][200005],bis[200005];
bool check(O x,O y)
{
	if (x.A==y.A)
	{
		if (x.T==y.T)
		{
			return x.N<y.N;
		}
		return x.T<y.T;
	}
	return x.A>y.A;
}
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>m>>k;
	for (int i=1;i<=k;i++)
	{
		cin>>times>>name>>team;
		if (q[team]==0)
		{
			q[team]=++cnt;
			NN[cnt]=team;
		}
		getline(cin,result);
		int a,b,c;
		int p = 0;
		for (; p < (int)times.size(); p++) {
			if (times[p] == ':')
				break;
			a = a * 10 + (times[p] - '0');
		}
		p++;
		for (; p < (int)times.size(); p++) {
			if (times[p] == ':')
				break;
			b = b * 10 + (times[p] - '0');
		}
		p++;
		for (; p < (int)times.size(); p++) {
			if (times[p] == ':')
				break;
			c = c * 10 + (times[p] - '0');
		}
//		a=times[0]-'0';
//		b=(times[2]-'0')*10+(times[3]-'0');
//		c=(times[5]-'0')*10+(times[6]-'0');
		int tm=a*3600+b*60+c;
		if (tm<=3600*4)
		{
			if (f[q[team]][name-'A'].used==0)
			{
				if (result[1]=='A')
				{	
					f[q[team]][name-'A'].used=1;
					f[q[team]][name-'A'].tmes+=tm;
				}
				else
				{
					f[q[team]][name-'A'].tmes+=20*60;
				}
			}
		}
		else
		{
			if (st[name-'A'][q[team]].ACer==0&&f[q[team]][name-'A'].used==0)
			{
				if (result[1]=='A')
				{	
					st[name-'A'][q[team]].ACer=1;
					st[name-'A'][q[team]].tm+=tm;
				}
				else
				{
					st[name-'A'][q[team]].tm+=20*60;
				}
			}
		}
	}
	for (int i=1;i<=cnt;i++)
	{
		int AC=0,Time=0;
		for (int j=0;j<n;j++)
		{
			if (f[i][j].used==1)
			{
				AC++;
				Time+=f[i][j].tmes;
			}
		}
		o.A=AC;
		o.T=Time;
		o.N=i;
		s.push(o);
	}
	while (!s.empty())
	{
		if(s.size()==1){
			cout<<NN[s.top().N]<<'\n';
			break;
		}
		o=s.top();
		s.pop();
		oo=s.top();
		s.pop();
		cout<<NN[o.N]<<"\n";
		bool boo=0;
		for (int i=0;i<n;i++)
		{
			if (st[i][o.N].ACer)
			{
				st[i][o.N].ACer=0;
				o.A++;
				o.T+=st[i][o.N].tm;
				if (check(o,oo))
				{
					s.push(o);s.push(oo);boo=1;
					break;
				}
			}
		}
		if (!boo)s.push(oo);
	}
	return 0;
}
2024/6/25 14:25
加载中...