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>
using namespace std;
int n, m, k, score[4150];
string codes[4150];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> k;
for (int i = 0; i < n; i++) {
cin >> codes[i];
}
srand(123);
for (int ii = 0; ii <= 1e9 / m; ii++) {
int i = rand() % n, j = rand() % n;
if (i == j) continue;
int diffCount = 0;
for (int k = 0; k < m; k++) if (codes[i][k] != codes[j][k]) diffCount++;
if (diffCount == k) {
score[j]++;
score[i]++;
}
}
for (int i = 0; i < n; i++) cerr << "// score[" << i << "] : " << score[i] << '\n';
cout << distance(score, max_element(score, score + n)) + 1 << '\n';
}
# | 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... |