제출 #1228472

#제출 시각아이디문제언어결과실행 시간메모리
1228472quanndGenetics (BOI18_genetics)C++20
27 / 100
2004 ms3208 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...