Submission #657642

#TimeUsernameProblemLanguageResultExecution timeMemory
657642MilosMilutinovicGenetics (BOI18_genetics)C++14
0 / 100
35 ms9544 KiB
/**
 *    author:  wxhtzdy
 *    created: 10.11.2022 15:59:08
**/
#include <bits/stdc++.h>

using namespace std;

string c = "ACGT";

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);  
  int n, m, k;
  cin >> n >> m >> k;
  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  const int N = 4100;
  vector<vector<bitset<N>>> f(2, vector<bitset<N>>(n));
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < m; k++) {
        f[i][j][k] = (c[i] == s[j][k] ? 1 : 0);  
      }
    }
  }
  vector<vector<int>> d(n, vector<int>(n));
  for (int p = 0; p < 2; p++) {
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        d[i][j] += (f[p][i] ^ f[p][j]).count();
      }
    }
  }
  vector<bool> is(n, true);
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (d[i][j] != k * 2) {
        is[i] = false;
        is[j] = false;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (is[i]) {
      cout << i + 1 << '\n';
    }
  }
  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...