This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
typedef long long ll;
const ll mod = (ll) 1e9 + 7;
const ll mx = (ll) 2e5 +7;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,k,ans=0,t;
cin>>n>>k>>t;
vector<string>v;
string s;
for(int i=0;i<n;i++)
{
cin>>s;
v.push_back(s);
}
for(int i=0;i<n;i++)
{
bool g=1;
for(int j=0;j<n;j++)
{
if(i==j)continue;
ll r=t;
bool f=1;
for(int h=0;h<k;h++)
{
if(v[i][h]!=v[j][h])
{
r--;
if(r==-1)
{
f=0;
break;
}
}
}
if(f==0||r!=0)
{
g=0;
break;
}
}
if(g==1)
{
ans=i+1;
break;
}
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |