| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 878162 | vjudge1 | Genetics (BOI18_genetics) | C++17 | 207 ms | 8820 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>
using namespace std;
#define ll long long
#define pb push_back
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2")
const int N = 4100 + 4;
int n, m, k;
char s[N][N];
bitset<N> t, b[N];
mt19937 rng(time(0));
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
bool AC = true;
cin >> n >> m >> k;
for (int i = 0; i < n; ++i) {
cin >> s[i];
s[i][m] = i;
}
shuffle(s, s + n, rng);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
if (s[i][j] == 'G') {
AC = 0;
}
else {
if (s[i][j] == 'C') {
b[i][j] = 1;
}
}
}
}
if (AC == false) {
for (int i = 0; i < n; ++i) {
int cntOk = 0;
for (int j = 0; j < n; ++j) {
if (j == i) {
continue;
}
int cnt = 0;
for (int l = 0; l < m; ++l) {
cnt += (s[i][l] != s[j][l]);
}
cntOk += (cnt == k);
}
if (cntOk == n - 1) {
cout << (int) s[i][m] + 1;
return 0;
}
}
}
for (int i = 0; i < n; ++i) {
int cntOk = 0;
for (int j = 0; j < n; ++j) {
if (i == j) {
continue;
}
t = b[i] ^ b[j];
cntOk += (t.count() == k);
}
if (cntOk == n - 1) {
cout << (int) s[i][m] + 1;
return 0;
}
}
return 0;
}
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... | ||||
