# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1093621 | vjudge1 | Genetics (BOI18_genetics) | C++17 | 349 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.
// #pragma GCC optimize("O3","unroll-loops")
#include <bits/stdc++.h>
using namespace std;
// #define
#define int long long
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define file "file"
#define bit(x, y) ((y >> x) & 1)
#define __lcm(a, b) a * b / __gcd(a, b)
#define R(x) {cout << x << "\n"; return;}
#define coutf(x) cout << fixed << setprecision(x)
#define inter(a) cout << a << "\n"; fflush(stdout)
mt19937_64 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
// declare
const int N = 4100;
int n, m, k, d[N + 5][4], r[N + 5];
map <char, int> mp;
string s[N + 5];
int rand(int l, int r)
{
int d = r - l + 1;
return rnd() % d + l;
}
void Solve()
{
mp['A'] = 0;
mp['T'] = 1;
mp['G'] = 2;
mp['C'] = 3;
int sum = 0;
cin >> n >> m >> k;
for (int i = 1; i <= n; ++i) r[i] = rand(1, 1e9);
for (int i = 1; i <= n; ++i)
{
sum += r[i];
cin >> s[i];
for (int j = 1; j <= m; ++j)
d[j][mp[s[i][j - 1]]] += r[i];
}
for (int i = 1; i <= n; ++i)
{
int now = 0;
for (int j = 1; j <= m; ++j)
now += sum - d[j][mp[s[i][j - 1]]];
if (now == (sum - r[i]) * k)
R(i);
}
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
if (fopen(file ".inp", "r"))
{
freopen (file ".inp", "r", stdin);
freopen (file ".out", "w", stdout);
}
int t = 1;
// cin >> t;
while (t--)
Solve();
cerr << "\nTIME: " << 1000 * clock() / CLOCKS_PER_SEC << "ms.";
}
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... |