QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102715 | #5254. Differences | csw_ccc# | TL | 0ms | 0kb | C++14 | 712b | 2023-05-03 16:31:55 | 2023-05-03 16:31:59 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
3585 4096 2048 ABBBBBBAABAAAAAAAAAAAAABAABABBBABABAAAAABABAAAABAABAABBABBAABAABABBABAABBABBABABABBAAAABBABAABBBBABBBAABBBBBABAABAAABAAABBBBAAAABAABAABABABABBBBBABAAABAAABBAABABBABAABBAABBAABABBBBAABAAAABAABBABAAABBAAAAAABAABBABBABAABABBBAABABBABABBBAAAAABBBABABABBAABAAAABBBBABABAABBBABABABBAABBBABAB...