QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#200251#7041. Girls Band Partylyzqs#WA 2987ms25200kbC++141.9kb2023-10-04 16:02:322023-10-04 16:02:33

Judging History

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

  • [2023-10-04 16:02:33]
  • 评测
  • 测评结果:WA
  • 用时:2987ms
  • 内存:25200kb
  • [2023-10-04 16:02:32]
  • 提交

answer

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <bitset> 
#include <cmath> 
#include <queue>
using namespace std;

#define x first
#define y second

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef pair<double,double> PDD; 
typedef pair<LD,int> PLDI;
typedef pair<LD,LD> PLDLD;
typedef pair<int,PII> PIII;
const int N = 200010,M=2*N,U=200000,P=13331,INF=1e9+10,mod=998244353;
const double PI=acos(-1);

int T,n,idx;
struct Node
{
	string name,color;
	LL v;
}a[N];
LL f[N][6][16];
vector<int> nums[N];
set<string> S1,S2;

int get(int u)
{
	int s=0;
	if(S1.count(a[u].name)) s+=2;
	else if(S2.count(a[u].color)) s+=1;
	return s; 
}

int main()
{ 
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>T;
	while(T--)
	{
		cin>>n;
		for(int i=1;i<=idx;i++) nums[i].clear();
		idx=0;
		map<string,int> f1;
		map<int,string> f2;
		for(int i=1;i<=n;i++) 
		{
			cin>>a[i].name>>a[i].color>>a[i].v;
			if(!f1.count(a[i].name))
			{
				idx++;
				f2[idx]=a[i].name;
				f1[a[i].name]=idx;
			}
			nums[f1[a[i].name]].push_back(i);
		}
		S1.clear(),S2.clear();
		for(int i=1;i<=5;i++)
		{
			string str;
			cin>>str;
			S1.insert(str);
		}
		string str;
		cin>>str;
		S2.insert(str);
		for(int i=0;i<=5;i++)
			for(int j=0;j<=15;j++)
				f[0][i][j]=-(LL)1e9;
		f[0][0][0]=0;
		for(int i=1;i<=idx;i++)
			for(int j=0;j<=5;j++)
				for(int k=0;k<=15;k++)
				{
					f[i][j][k]=f[i-1][j][k];
					if(j)
					{
						for(auto &u:nums[i])
						{
							int v=get(u);
							if(v>k) continue;
							f[i][j][k]=max(f[i][j][k],f[i-1][j-1][k-v]+a[i].v);
						}
					}
				}
		LL ans=0;
		for(int i=0;i<=15;i++)
			ans=max(ans,(LL)floor(f[idx][5][i]*((double)i/10+1)));
		printf("%lld\n",ans);
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 24988kb

input:

1
6
Saaya Power 45000
Kokoro Happy 45000
Kasumi Cool 45000
Rimi Power 45000
Aya Pure 45000
Aya Power 2000
Saaya Tae Kasumi Rimi Arisa
Power

output:

382500

result:

ok 1 number(s): "382500"

Test #2:

score: -100
Wrong Answer
time: 2987ms
memory: 25200kb

input:

50
6
Tae Pure 13573
Chisato Happy 48889
Hina Power 36087
Kasumi Cool 5878
Rimi Power 21091
Rinko Cool 21035
Eve Tomoe Sayo Saya Tsugumi
Power
8
Hina Power 33669
Kokoro Happy 48080
Tsugumi Cool 37215
Lisa Power 22671
Kaoru Pure 3556
Hagumi Happy 26536
Rimi Power 20561
Maya Power 29893
Kaoru Chisato H...

output:

168810
249091
164438
154343
193986
156542
120123
257794
205055
218506
378456
408580
380563
374244
360653
379531
339153
380881
341530
360462
370645
380813
312044
347704
388832
330308
414520
430256
336595
385158
391741
330896
378828
340768
324638
369634
407575
344839
371621
331877
319513
384383
325830...

result:

wrong answer 1st numbers differ - expected: '196945', found: '168810'