QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#129274#5499. AliasesForever_Young#WA 0ms7796kbC++141008b2023-07-22 13:26:582023-07-22 13:26:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-22 13:26:59]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:7796kb
  • [2023-07-22 13:26:58]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
char ts[1600000];
char s1[210000][20],s2[210000][20];
int n,ansa,ansb,ansc;
int main()
{
	int T;
	cin>>T;
	while (T--)
	{
		scanf("%d",&n);
		for(int i=1;i<=n;i++)
		{
			int len;
			scanf("%s",ts+1);
			len=strlen(ts+1);
			for(int j=1;j<=min(10,len);j++)s1[i][j]=ts[j];

			scanf("%s",ts+1);
			len=strlen(ts+1);
			for(int j=1;j<=min(10,len);j++)s2[i][j]=ts[j];
		}
		int ans=2147483647;
		for(int a=0;a<=10;a++)
		for(int b=0;b<=10;b++)
		{
			static map<string,int> dic; dic.clear();
			int maxcnt=0;
			for(int i=1;i<=n;i++)
			{
				string s="";
				for(int j=1;j<=a;j++)s+=s1[i][j];
				for(int j=1;j<=b;j++)s+=s2[i][j];
				dic[s]++;
				maxcnt=max(maxcnt,dic[s]);
			}
			int c=0; long long now=1;
			while (now<maxcnt)c++,now=now*36;
			if (a+b+c==0)c++;
			if (ans>a+b+c)ans=a+b+c,ansa=a,ansb=b,ansc=c;
		}
		printf("%d %d %d\n",ansa,ansb,ansc);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 7796kb

input:

1
11
sven eriksson
erik svensson
sven svensson
erik eriksson
bjorn eriksson
bjorn svensson
bjorn bjornsson
erik bjornsson
sven bjornsson
thor odinsson
odin thorsson

output:

0 0 1

result:

wrong answer Loginy nieunikalne! (test case 1)