# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
62823 | SpaimaCarpatilor | Genetics (BOI18_genetics) | C++17 | 421 ms | 21068 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 N, M, K;
char sir[5009][5009];
long long coef[5000], f[5009][4];
int code (char c)
{
if (c == 'A') return 0;
if (c == 'C') return 1;
if (c == 'G') return 2;
return 3;
}
int rand15 () {return rand () & 32767;}
int rand30 () {return (rand15 () << 15) | rand15 ();}
long long rand60 () {return ((long long) rand30 () * (1LL << 30)) | rand30 ();}
int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);
srand (time (0));
scanf ("%d %d %d\n", &N, &M, &K);
for (int i=1; i<=N; i++)
coef[i] = rand60 ();
for (int i=1; i<=N; i++)
{
scanf ("%s", sir[i] + 1);
for (int j=1; j<=M; j++)
sir[i][j] = code (sir[i][j]),
f[j][sir[i][j]] += coef[i];
}
for (int i=1; i<=N; i++)
{
long long needed = 0, curr = 0;
for (int j=1; j<=N; j++)
if (j != i)
needed += 1LL * K * coef[j];
for (int j=1; j<=M; j++)
for (int k=0; k<4; k++)
if (k != sir[i][j])
curr += f[j][k];
if (curr == needed)
{
printf ("%d\n", i);
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... |