QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102724 | #5254. Differences | csw_ccc# | TL | 0ms | 0kb | C++14 | 788b | 2023-05-03 16:36:52 | 2023-05-03 16:36:56 |
Judging History
answer
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include<string>
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];
str[i].resize(m);
scanf("%s",&str[i][0]);
}
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...