QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#141477#5254. DifferencesPhantomThreshold#TL 0ms0kbC++20847b2023-08-17 14:49:052023-08-17 14:49:09

Judging History

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

  • [2023-08-17 14:49:09]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2023-08-17 14:49:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n,m,k;
	cin>>n>>m>>k;
	vector<string> s(n+5);
	for(int i=1;i<=n;i++)
	{
		cin>>s[i];
	}
	auto cmp=[&](int x,int y)
	{
		int kk=0;
		for(int i=0;i<m;i++)
		{
			if(s[x][i]!=s[y][i])
			{
				kk++;
				if(kk>k)return false;
				if(kk+m-i-1<k)return false;
			}
		}
		if(kk==k)return true;
		return false;
	};
	vector<int> ok(n+5,1);
	for(int i=1;i<=n;i++)
	{
		if(not ok[i])continue;
		for(int j=i+1;j<=n;j++)
		{
			if(not cmp(i,j))
			{
				ok[i]=ok[j]=0;
			}
		}
		if(ok[i])
		{
			for(int j=1;j<i;j++)
			{
				if(not cmp(i,j))
				{
					ok[i]=0;
					break;
				}
			}
			if(ok[i])break;
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(ok[i])
		{
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

详细

Test #1:

score: 0
Time Limit Exceeded

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:


result: