QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#129274 | #5499. Aliases | Forever_Young# | WA | 0ms | 7796kb | C++14 | 1008b | 2023-07-22 13:26:58 | 2023-07-22 13:26:59 |
Judging History
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)