#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld double
#define FOR(L , R) for(int i = L;i <= R;i++)
const int INF = 1e18;
const int sz = 2e5 + 5;
const int usz = 1e6 + 5;
const int mod = 998244353;
int cnt(string a , string b)
{
int ans = 0;
for(int i = 0;i < a.size();i++){
if(a[i] != b[i]){
ans++;
}
}
return ans;
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n , m , k;
cin >> n >> m >> k;
vector < string > a(n + 1);
vector < string > q(n + 1);
for(int i = 1;i <= n;i++) cin >> a[i] , q[i] = a[i];
sort(q.begin() , q.end());
string f = q[1] , s = q[n];
for(int i = 1;i <= n;i++)
{
if(a[i] == f or a[i] == s) continue;
if(cnt(a[i] , f) == k && cnt(a[i] , s)){
cout << i << endl;
return 0;
}
}
}
# | 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... |