#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define pii pair <ll, ll>
#define fi first
#define se second
const ll N = 5000, inf = 1e18, mod = 1e9 + 7, block = 320;
int n, m, k;
string a[N];
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m >> k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
a[i] = "#" + a[i];
}
for (int i = 1; i <= n; i++) {
bool check = true;
for (int j = 1; j < i; j++) {
int diff = 0;
for (int t = 1; t <= m; t++) {
diff += (a[i][t] != a[j][t]);
}
if (diff != k) {
check = false;
break;
}
}
if (!check) continue;
for (int j = i + 1; j <= n; j++) {
int diff = 0;
for (int t = 1; t <= m; t++) {
diff += (a[i][t] != a[j][t]);
}
if (diff != k) {
check = false;
break;
}
}
if (check) {
cout << i;
break;
}
}
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... |