# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1091583 | MateiKing80 | Genetics (BOI18_genetics) | C++14 | 256 ms | 33388 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;
using ll = long long;
#define int ll
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int rangerng(int l, int r)
{
return uniform_int_distribution<int> (l, r)(rng);
}
int n, m, k;
char a[4102][4102];
int Rnd[4102], P[4102];
int S[4102];
void solve()
{
cin >> n >> m >> k;
for(int i = 1; i <= n; i ++)
for(int j = 1; j <= m; j ++)
cin >> a[i][j];
for(int j = 1; j <= m; j ++)
{
int All = 0;
S['A'] = S['G'] = S['T'] = S['C'] = 0;
for(int i = 1; i <= n; i ++)
{
All += Rnd[i];
S[a[i][j]] += Rnd[i];
}
for(int i = 1; i <= n; i ++)
P[i] += All - S[a[i][j]];
}
int Sum = 0;
for(int i = 1; i <= n; i ++)
Sum += 1ll * Rnd[i] * k;
for(int i = 1; i <= n; i ++)
{
int w = 1ll * Rnd[i] * k;
if(P[i] == Sum - w)
{
cout << i;
return;
}
}
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for(int i = 1; i <= 4100; i ++)
Rnd[i] = rangerng(1, 1e18);
solve();
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... |