QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#141631#5254. DifferencesPhantomThreshold#WA 1941ms20384kbC++201.1kb2023-08-17 18:22:482023-08-17 18:22:51

Judging History

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

  • [2023-08-17 18:22:51]
  • 评测
  • 测评结果:WA
  • 用时:1941ms
  • 内存:20384kb
  • [2023-08-17 18:22:48]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	mt19937 rng((unsigned long long)(new char));
	int n,m,k;
	cin>>n>>m>>k;
	vector<pair<string,int>> s(n+5);
	for(int i=1;i<=n;i++)
	{
		cin>>s[i].first;
		s[i].second=i;
	}
	random_shuffle(s.begin()+1,s.begin()+n+1,[&](int x){return rng()%x;});
	auto cmp=[&](int x,int y)
	{
		int kk=0;
		for(int i=0;i<m;i++)
		{
			if(s[x].first[i]!=s[y].first[i])
			{
				kk++;
				if(kk>k)return false;
				if(kk+m-i-1<k)return false;
			}
		}
		if(kk==k)return true;
		return false;
	};
	vector<int> cnt(n+5,0);
	const int magic=33;
	for(int i=1;i<=min(n,magic);i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			if(i==j)continue;
			if(cmp(i,j))
			{
				cnt[j]++;cnt[i]++;
			}
		}
	}
//	for(int i=1;i<=n;i++)cerr<<cnt[i]<<endl;
	for(int i=1;i<=min(n,magic);i++)
	{
		if(cnt[i]==n-1)
		{
			cout<<s[i].second<<endl;
			return 0;
		}
	}
	for(int i=magic+1;i<=n;i++)
	{
		if(cnt[i]==magic)
		{
			cout<<s[i].second<<endl;
			return 0;
		}
	}
	assert(0);
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1941ms
memory: 20384kb

input:

3585 4096 2048
ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...

output:

2237

result:

wrong answer 1st lines differ - expected: '1397', found: '2237'