QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#102715#5254. Differencescsw_ccc#TL 0ms0kbC++14712b2023-05-03 16:31:552023-05-03 16:31: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-05-03 16:31:59]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2023-05-03 16:31:55]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;

int n,m,k;
string str[200000+5];

bool getdis(string str1,string str2)
{
	int cnt=0;
	for(int i=0; i<m; i++)
	{
		if(str1[i]!=str2[i])
		{
			cnt++;
			if(cnt>k) return false;
		}
	}
	return cnt==k;
}

bool vis[200000+5];

int main()
{
	scanf("%d %d %d",&n,&m,&k);
	
	for(int i=1; i<=n; i++) cin>>str[i]; 
	for(int i=1; i<=n; i++)
	{
		if(vis[i]) continue;
		
		for(int j=1; j<=n; j++)
		{
			if(j==i) continue;
			if(!getdis(str[i],str[j]))
			{
				vis[i]=vis[j]=true;
				break;
			}
		}
		
		if(!vis[i])
		{
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}

详细

Test #1:

score: 0
Time Limit Exceeded

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:


result: