Submission #473635

#TimeUsernameProblemLanguageResultExecution timeMemory
473635elgamalsalmanGenetics (BOI18_genetics)C++14
0 / 100
59 ms3192 KiB
#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(2004);
  for (int ii = 0; ii <= 20; ii++) {
    int i = rand() % n;
    for (int j = 0; j < n; j++) {
      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]++;
    }
  }

  //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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...