QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#707761#8230. Submissionsheyuhao#Compile Error//C++203.4kb2024-11-03 17:25:392024-11-03 17:25:43

Judging History

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

  • [2024-11-03 17:25:43]
  • 评测
  • [2024-11-03 17:25:39]
  • 提交

answer

#pragma GCC optimize(3, "Ofast", "inline")
#include <iostream>
//  #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;
struct submission
{
    int num;
    string name;
    int time,pro;
    bool zt;
}sub[100010];
int m;
bool cmp(submission a,submission b)
{
	if(a.name!=b.name)
		return a.name<b.name;
	if(a.pro!=b.pro)
		return a.pro<b.pro;
	if(a.time!=b.time)
		return a.time<b.time;
	if(a.num!=b.num)
		return a.num<b.num;
}
bool cmp1(pair<int,int> a,pair<int,int> b)
{
	if(a.first!=b.first)
		return a.first>b.first;
	return a.second<b.second;
}
pair<int,int> all[100010],all1[100010];
string dname[100010];
bool st[100010];
void solve()
{
  	int m;
  	cin>>m;
	for(int i=1;i<=m;i++)
		st[i]=false;
	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;
	}
	sort(sub+1,sub+1+m,cmp);
	// for(int i=1;i<=m;i++)
	// cout<<sub[i].num<<" "<<sub[i].name<<" "<<sub[i].pro<<" "<<sub[i].time<<" "<<sub[i].zt<<"\n";
	int pos=1; //下标
	int sum=0,sumd=0; //过一道题的队伍
	while(pos<=m)
	{
		string name=sub[pos].name; //当前队名
		bool flag=false; //是否过题
		int guo=0,fa=0; //过题数和罚时
		int best=500;
		int best_more=500,best_less=0;
		while(sub[pos].name==name&&pos<=m)
		{
			int pro=sub[pos].pro; //当前题目
			bool flag1=false;  //是否过题
			int ti=0; //罚时
			int mint=sub[pos].time;
			// cout<<name<<" "<<pro<<" "<<mint<<"\n";
			while(sub[pos].pro==pro&&sub[pos].name==name&&pos<=m)
			{
				if(sub[pos].zt)
				{
					flag1=true;
					ti+=sub[pos].time;
				}
				else if(!flag1)
					ti+=sub[pos].time;
				pos++;
			}
			if(flag1)
			{
				flag=true;
				guo++;
				fa+=ti;
				// cout<<name<<" "<<pro<<" "<<best_less<<"\n";
				best_less=max(best_less,ti-mint);
				
			}
			else
			{
				best_more=min(best_more,mint);
			}
		}
		sumd++;
		dname[sumd]=name;
		if(best_more!=500)
			all1[sumd].first=guo+1,all1[sumd].second=fa+best_more;
		else
			all1[sumd].first=guo,all1[sumd].second=fa-best_less;
		// cout<<name<<" "<<guo<<" "<<fa<<"\n";
		// cout<<all1[sumd].first<<" "<<all[sumd].second<<"\n";
		if(flag)
		{
			sum++;
			all[sum].first=guo;
			all[sum].second=fa;
		}
	}
	// for(int i=1;i<=sum;i++)
	// 	cout<<all[i].first<<" "<<all[i].second<<"\n";
	sort(all+1,all+1+sum,cmp1);
	int gold=min(35,(sum+9)/10);
	int gstan=all[gold].first,tstand=all[gold].second;
	// cout<<gstan<<" "<<tstand<<"\n";
	int ans=0;
	for(int i=1;i<=sumd;i++)
		if(all1[i].first>gstan||all1[i].first==gstan&&all1[i].second<=tstand)
			st[i]=true,ans++;
	cout<<ans<<"\n";
	for(int i=1;i<=sumd;i++)
		if(st[i])
			cout<<dname[i]<<" ";
	cout<<"\n";
}
int main()
{
    IOS;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#ifndef ONLINE_JUDGE
    clock_t start_time = clock();
#endif
    int t;
    t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
#ifndef ONLINE_JUDGE
    cout << "Used " << (double)(clock() - start_time) << " ms" << endl;
#endif
    return 0;
}

詳細信息

answer.code: In function ‘void solve()’:
answer.code:60:9: error: ‘sort’ was not declared in this scope; did you mean ‘short’?
   60 |         sort(sub+1,sub+1+m,cmp);
      |         ^~~~
      |         short
answer.code: In function ‘bool cmp(submission, submission)’:
answer.code:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^