# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1249225 | yoshi_33550336 | Genetics (BOI18_genetics) | C++20 | 2095 ms | 67352 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifndef yoshi_likes_e4
#define endl '\n'
#endif
#define problem ""
#define multitest 0
#define debug(x) cerr << #x << " = " << x << endl;
void init()
{
}
string A[4100];
bitset<4100> Ab[4][4100];
int C[256];
int cnt[4101];
int diff[4100][4100];
void Yoshi()
{
C['A'] = 0;
C['T'] = 1;
C['C'] = 2;
C['G'] = 3;
int n, m, k;
cin >> n >> m >> k;
for (int i = 0; i < n; i++)
cin >> A[i];
for (int i = 0; i < n; i++)
for (int j = 0; j < m; j++)
Ab[C[A[i][j]]][i][j] = 1;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
diff[j][i] = diff[i][j] =
m -
((Ab[0][j] & Ab[0][i]) | (Ab[1][j] & Ab[1][i]) | (Ab[2][j] & Ab[2][i]) | (Ab[3][j] & Ab[3][i])).count();
for (int i = 0; i < n; i++)
{
bool ck = 1;
for (int j = 0; j < n; j++)
{
if (diff[i][j] != k && i != j)
{
ck = 0;
break;
}
}
if (ck)
cout << i + 1 << endl, exit(0);
}
}
signed main()
{
#ifndef yoshi_likes_e4
ios::sync_with_stdio(0);
if (fopen(problem ".inp", "r"))
{
freopen(problem ".inp", "r", stdin);
freopen(problem ".out", "w", stdout);
}
#endif
init();
int t = 1;
#if multitest
fin >> t;
#endif
while (t--)
Yoshi();
}
Compilation message (stderr)
# | 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... |