QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#234862#5499. Aliasesraztun#WA 1ms3444kbC++20933b2023-11-02 00:14:512023-11-02 00:14:51

Judging History

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

  • [2023-11-02 00:14:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3444kb
  • [2023-11-02 00:14:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int zz; cin>>zz;
	while (zz--)
	{
		int n; cin>>n;
		vector<string>a(n), b(n);
		for (int i=0; i<n; i++)
		{
			cin>>a[i]>>b[i];
		}
		int ans=to_string(n-1).size(), a1=0, a2=0, a3=ans;
		for (int x=0; x<ans; x++)
		{
			for (int y=0; x+y<ans; y++)
			{
				string pom="";
				unordered_map<string, int>mapa;
				for (int i=0; i<n; i++)
				{
					for (int j=0; j<min(x, (int)a[i].size()); j++) pom+=a[i][j];
					for (int j=0; j<min(y, (int)b[i].size()); j++) pom+=b[i][j];
					mapa[pom]++;
				}
				int c=0;
				for (auto i : mapa)
				{
					if (i.second>1) c=max(c, (int)to_string(i.second-1).size());
					if (x+y+c >= ans) break;
				}
				if (x+y+c < ans)
				{
					ans=x+y+c;
					a1=x;
					a2=y;
					a3=c;
				}
			}
		}
		cout<<a1<<" "<<a2<<" "<<a3<<"\n";
	}
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3444kb

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 1 0

result:

wrong answer Loginy nieunikalne! (test case 1)