# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95152 | popovicirobert | Genetics (BOI18_genetics) | C++14 | 311 ms | 27288 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>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define ld long double
// 217
// 44
using namespace std;
const int MAXN = 4100;
char str[MAXN + 1][MAXN + 1];
ll hsh[MAXN + 1], sum[MAXN + 1][4];
int pos[256];
int main() {
//ifstream cin("A.in");
//ofstream cout("A.out");
int i, j, n, m, k;
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
srand(time(NULL));
cin >> n >> m >> k;
ll tot = 0;
for(i = 1; i <= n; i++) {
cin >> str[i] + 1;
hsh[i] = rand();
tot += hsh[i];
}
pos['A'] = 0;
pos['C'] = 1;
pos['G'] = 2;
pos['T'] = 3;
for(j = 1; j <= m; j++) {
for(i = 1; i <= n; i++) {
sum[j][pos[str[i][j]]] += hsh[i];
}
}
for(i = 1; i <= n; i++) {
ll cur = 0;
for(j = 1; j <= m; j++) {
cur += sum[j][pos[str[i][j]]];
}
if(cur - m * hsh[i] == (tot - hsh[i]) * (m - k)) {
cout << i;
return 0;
}
}
//cin.close();
//cout.close();
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... |