답안 #728760

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
728760 2023-04-23T03:37:29 Z jampm Genetics (BOI18_genetics) C++17
0 / 100
1734 ms 18668 KB
#include <bits/stdc++.h>
using namespace std;
#define sz(a) (int)a.size()
int const Mxn = 4101;

int lobo[26] = {0, -1, 1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1};
struct relsB {
  int_fast64_t B[4][Mxn/64 + 1];
  void init(string & s) {
    for (int i = 0; i < sz(s); i++) {
      B[lobo[s[i] - 'A']][i/64] ^= 1LL<<(i%64);
    }
  }
} A[Mxn];
int grid[Mxn][Mxn], is_good[Mxn];

int count(relsB & X, relsB & Y, int ans = 0) {
  for (int i = 0; i <= Mxn/64; i++) {
    for (int j = 0; j < 4; j++) {
      ans += __builtin_popcount((X.B[j][i])^(Y.B[j][i]));
    }
  }
  return ans;
}

int main() {
  ios_base::sync_with_stdio(0); cin.tie(0);
  int n, k, m; cin >> n >> m >> k;
  k <<= 1; string s;
  for (int i = 0; i < n; i++) {
    cin >> s; A[i].init(s);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      grid[i][j] = count(A[i], A[j]);
    }
  }
  for (int i = 0; i < n; i++) {
    is_good[i] = 1;
    for (int j = 0; j < n; j++) {
      if (j == i) continue;
      is_good[i] &= (grid[i][j] == k);
    }
  }
  for (int i = 0; i < n; i++) {
    if (!is_good[i]) continue;
    cout << i + 1 << endl; break;
  }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1734 ms 18668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1734 ms 18668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 852 KB Output isn't correct
2 Halted 0 ms 0 KB -