QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#102883#5254. DifferenceszswzswzswTL 0ms0kbC++14668b2023-05-03 19:28:202023-05-03 19:28:25

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 19:28:25]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2023-05-03 19:28:20]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=501000;
int n,m,k;
string st[N];
long long res[N];
int cnt[28];
bool chk(string &aa,string &bb){
	int tmp=0;
	for(int i=0;i<m&&tmp<=k;i++)if(aa[i]!=bb[i])++tmp;
	return tmp==k;
}
int main()
{
	cin>>n>>m>>k;
	for(int i=1;i<=n;i++)cin>>st[i];
	for(int now=0;now<m;now++)
	{
		for(int i=0;i<26;i++)cnt[i]=0;
		for(int i=1;i<=n;i++)cnt[st[i][now]-'A']++;
		for(int i=1;i<=n;i++)res[i]+=(n-cnt[st[i][now]-'A']);
	}
	for(int i=1;i<=n;i++)if(res[i]==1ll*(n-1)*k){
		bool tg=1;
		for(int j=1;j<=n;j++)if(i!=j&&!chk(st[i],st[j])){tg=0;break;}
		if(tg)return cout<<i,0;
	}cout<<0;
	return 0;
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:


result: