QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#707786#8230. Submissionsjkzj456789WA 3ms13996kbC++203.3kb2024-11-03 17:31:142024-11-03 17:31:15

Judging History

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

  • [2024-11-03 17:31:15]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:13996kb
  • [2024-11-03 17:31:14]
  • 提交

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+=20;
				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;
}

詳細信息

Test #1:

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

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

result:

ok 2 test cases ok. (2 test cases)

Test #2:

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

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:

1
jiangly_fan 
1
conqueror_of_tourist 

result:

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