| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 532680 | sidon | Genetics (BOI18_genetics) | C++17 | 501 ms | 70060 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.
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx2", "popcnt", "sse4.2")
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int Z = 4100;
int N, M, K;
bitset<Z<<2> a[Z];
int g[100];
bool chk[Z][Z], cnt[Z][Z];
int cntAt[Z][4];
string inp[Z];
int main() {
ios::sync_with_stdio(0), cin.tie(0);
g['C'] = 1;
g['G'] = 2;
g['T'] = 3;
cin >> N >> M >> K;
int o[N];
for(int i = 0; i < N; ++i) {
cin >> inp[i];
for(int j = 0; j < M; ++j) {
a[i][g[int(inp[i][j])] * Z + j] = 1;
++cntAt[j][g[int(inp[i][j])]];
}
o[i] = i;
}
shuffle(o, o + N, rng);
for(const int &i : o) {
bool ok = 1;
int sum = 0;
for(int j = 0; j < M; ++j)
sum += N - cntAt[j][g[int(inp[i][j])]];
if(sum != (N - 1) * K) continue;
a[i].flip();
for(const int &j : o) if(i != j) {
bool c = (chk[i][j] ? cnt[i][j] : (a[i] & a[j]).count() == K);
chk[j][i] = 1;
cnt[j][i] = c;
if(!c) {
ok = 0;
break;
}
}
if(ok) {
cout << i + 1;
return 0;
}
a[i].flip();
}
}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... | ||||
