#include<bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;
using db=double;
using sll=__int128;
using lb=long double;
int32_t main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0));
int n,m,k; cin>>n>>m>>k; vector<string>a(n+1);
for(int i=1; i<=n; i++){ cin>>a[i]; }
int ans=-1;
for(int i=1; i<=n; i++){
bool ok=true;
for(int j=1; j<=n; j++){
int cnt=0;
for(int idx=0; idx<m; idx++){
cnt+=a[i][idx]!=a[j][idx];
}
if(cnt>k)ok=false;
}
if(ok)ans=i;
}
cout<<ans<<'\n';
}
/*
O what can ail thee, knight-at-arms,
Alone and palely loitering?
The sedge has withered from the lake,
And no birds sing.
O what can ail thee, knight-at-arms,
So haggard and so woe-begone?
The squirrel’s granary is full,
And the harvest’s done.
I see a lily on thy brow,
With anguish moist and fever-dew,
And on thy cheeks a fading rose
Fast withereth too.
*/
# | 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... |