# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
777828 | TheSahib | Genetics (BOI18_genetics) | C++14 | 2045 ms | 7908 KiB |
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>
#pragma GCC target("popcnt")
#define ll long long
#define oo 1e9
#define pii pair<int, int>
using namespace std;
const int MAX = 1 << 12;
int n, m, k;
bitset<MAX> st[MAX][4];
int comp(int a, int b){
int cnt = 0;
for (int i = 0; i < 4; i++)
{
cnt += (st[a][i] & st[b][i]).count();
}
return m - cnt;
}
void solve(){
scanf("%d%d%d", &n, &m, &k);
for (int i = 0; i < n; i++)
{
getchar();
for (int j = 0; j < m; j++)
{
char c = getchar();
if(c == 'G') c = 'B';
if(c == 'T') c = 'D';
st[i][c - 'A'][j] = 1;
}
}
vector<int> v;
v.resize(n);
iota(v.begin(), v.end(), 0);
srand(time(0));
random_shuffle(v.begin(), v.end());
bitset<MAX> p;
for (int i = 0; i < n; i++)
{
p[i] = 1;
}
for (int j:v)
{
if(!p[j]) continue;
int cnt = 0;
for(int i:v){
if(i == j) continue;
if(comp(i, j) != k){
p[j] = 0;
}
else cnt++;
}
if(cnt == n - 1){
cout << j + 1 << '\n';
return;
}
}
}
int main()
{
solve();
}
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... |