# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
601449 | penguinhacker | Genetics (BOI18_genetics) | C++17 | 142 ms | 36264 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")
using namespace std;
#define ll long long
#define ar array
#define ull unsigned ll
mt19937_64 rng(42);
const int mxN=4100;
int n, m, k, mp[256];
string s[mxN];
ull w[mxN], w_sum, dp[mxN][4];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
mp['A']=0, mp['C']=1, mp['T']=2, mp['G']=3;
cin >> n >> m >> k;
for (int i=0; i<n; ++i) {
cin >> s[i];
w[i]=rng();
w_sum+=w[i];
for (int j=0; j<m; ++j)
dp[j][mp[s[i][j]]]+=w[i];
}
for (int i=0; i<n; ++i) {
ull hsh=0;
for (int j=0; j<m; ++j)
hsh+=dp[j][mp[s[i][j]]]-w[i];
if (hsh==(m-k)*(w_sum-w[i])) {
cout << i+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... |