# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
693015 | MilosMilutinovic | Genetics (BOI18_genetics) | C++17 | 772 ms | 36184 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;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, k;
cin >> n >> m >> k;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
mt19937 rng(time(0));
vector<int> val(n);
for (int i = 0; i < n; i++) {
val[i] = rng() % (int) 1e9;
}
auto Id = [&](char c) {
if (c == 'A') return 0;
if (c == 'G') return 1;
if (c == 'C') return 2;
if (c == 'T') return 3;
};
vector<long long> d(n);
for (int j = 0; j < m; j++) {
vector<long long> f(4);
for (int i = 0; i < n; i++) {
f[Id(s[i][j])] += val[i];
}
for (int i = 0; i < n; i++) {
for (int k = 0; k < 4; k++) {
if (Id(s[i][j]) != k) {
d[i] += f[k];
}
}
}
}
long long sum = 0;
for (int i = 0; i < n; i++) {
sum += val[i];
}
for (int i = 0; i < n; i++) {
if (d[i] == (sum - val[i]) * k) {
cout << i + 1 << '\n';
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... |